({
plusColor = '#fb3a5d',
backgroundColor = 'transparent',
plusSize = 60,
className,
fade = true,
style,
...props
})
| 9 | } |
| 10 | |
| 11 | export const BackgroundPlus: React.FC<PlusPatternBackgroundProps> = ({ |
| 12 | plusColor = '#fb3a5d', |
| 13 | backgroundColor = 'transparent', |
| 14 | plusSize = 60, |
| 15 | className, |
| 16 | fade = true, |
| 17 | style, |
| 18 | ...props |
| 19 | }) => { |
| 20 | const encodedPlusColor = encodeURIComponent(plusColor) |
| 21 | |
| 22 | const maskStyle: React.CSSProperties = fade |
| 23 | ? { |
| 24 | maskImage: 'radial-gradient(circle, white 10%, transparent 90%)', |
| 25 | WebkitMaskImage: 'radial-gradient(circle, white 10%, transparent 90%)', |
| 26 | } |
| 27 | : {} |
| 28 | |
| 29 | // SVG taken from https://heropatterns.com/ |
| 30 | const backgroundStyle: React.CSSProperties = { |
| 31 | backgroundColor, |
| 32 | backgroundImage: `url("data:image/svg+xml,%3Csvg width='${plusSize}' height='${plusSize}' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='${encodedPlusColor}' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`, |
| 33 | ...maskStyle, |
| 34 | ...style, |
| 35 | } |
| 36 | |
| 37 | return ( |
| 38 | <div |
| 39 | className={`absolute inset-0 h-full w-full ${className}`} |
| 40 | style={backgroundStyle} |
| 41 | {...props} |
| 42 | /> |
| 43 | ) |
| 44 | } |
| 45 | |
| 46 | export default BackgroundPlus |
nothing calls this directly
no outgoing calls
no test coverage detected