({
color = '#fb3a5d',
cellSize = '25px',
strokeWidth = '3px',
className,
fade = true,
...props
}: Partial<BackgroundGridProps> & HTMLProps<HTMLDivElement>)
| 9 | } |
| 10 | |
| 11 | const BackgroundGrid = ({ |
| 12 | color = '#fb3a5d', |
| 13 | cellSize = '25px', |
| 14 | strokeWidth = '3px', |
| 15 | className, |
| 16 | fade = true, |
| 17 | ...props |
| 18 | }: Partial<BackgroundGridProps> & HTMLProps<HTMLDivElement>) => { |
| 19 | const svg = ` |
| 20 | <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' stroke='${color}' stroke-width='${strokeWidth}' fill-opacity='0.4' > |
| 21 | <path d='M 100 0 L 100 200'/> |
| 22 | <path d='M 0 100 L 200 100'/> |
| 23 | </svg> |
| 24 | ` |
| 25 | const svgDataUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svg)}` |
| 26 | |
| 27 | return ( |
| 28 | <div |
| 29 | className={`pointer-events-none absolute inset-0 left-0 top-0 flex h-full w-full ${className}`} |
| 30 | style={{ |
| 31 | backgroundImage: `url("${svgDataUrl}")`, |
| 32 | backgroundRepeat: 'repeat', |
| 33 | backgroundSize: cellSize, |
| 34 | maskImage: fade |
| 35 | ? `radial-gradient(ellipse at top, white, transparent 70%)` |
| 36 | : undefined, |
| 37 | WebkitMaskImage: fade |
| 38 | ? `radial-gradient(ellipse at top, white, transparent 70%)` |
| 39 | : undefined, |
| 40 | }} |
| 41 | {...props} |
| 42 | ></div> |
| 43 | ) |
| 44 | } |
| 45 | |
| 46 | export default BackgroundGrid |
nothing calls this directly
no outgoing calls
no test coverage detected