({
patternColor = '#fb3a5d',
backgroundColor = 'transparent',
className,
fade = true,
style,
...props
})
| 9 | } |
| 10 | |
| 11 | export const BackgroundBricks: React.FC<CustomPatternBackgroundProps> = ({ |
| 12 | patternColor = '#fb3a5d', |
| 13 | backgroundColor = 'transparent', |
| 14 | className, |
| 15 | fade = true, |
| 16 | style, |
| 17 | ...props |
| 18 | }) => { |
| 19 | const encodedPatternColor = encodeURIComponent(patternColor) |
| 20 | |
| 21 | const maskStyle: React.CSSProperties = fade |
| 22 | ? { |
| 23 | maskImage: 'radial-gradient(circle, white 10%, transparent 90%)', |
| 24 | WebkitMaskImage: 'radial-gradient(circle, white 10%, transparent 90%)', |
| 25 | } |
| 26 | : {} |
| 27 | |
| 28 | // SVG taken from https://heropatterns.com/ |
| 29 | const backgroundStyle: React.CSSProperties = { |
| 30 | backgroundColor, |
| 31 | backgroundImage: `url("data:image/svg+xml,%3Csvg width='42' height='44' viewBox='0 0 42 44' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='Page-1' fill='none' fill-rule='evenodd'%3E%3Cg id='brick-wall' fill='${encodedPatternColor}' fill-opacity='0.4'%3E%3Cpath d='M0 0h42v44H0V0zm1 1h40v20H1V1zM0 23h20v20H0V23zm22 0h20v20H22V23z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`, |
| 32 | ...maskStyle, |
| 33 | ...style, |
| 34 | } |
| 35 | |
| 36 | return ( |
| 37 | <div |
| 38 | className={`absolute inset-0 h-full w-full ${className}`} |
| 39 | style={backgroundStyle} |
| 40 | {...props} |
| 41 | /> |
| 42 | ) |
| 43 | } |
| 44 | |
| 45 | export default BackgroundBricks |
nothing calls this directly
no outgoing calls
no test coverage detected