mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-08-29 10:18:24 +02:00
* chore: upgrade eslint to v9 latest with compatible lint deps Agent-Logs-Url: https://github.com/lucide-icons/lucide/sessions/f7c1f1b5-d213-4afa-91a8-b799a16397ec * Fix eslint config * Fix a lot of eslint errors * Fix eslint * Fix eslint errors * Fix eslint errors * Fix types * Fix eslint warning * Format code * Add eslint 10 * Remove unused vars * Update pnpm * Update deps --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
97 lines
2.1 KiB
TypeScript
97 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
|
|
interface BackdropProps {
|
|
src: string;
|
|
color?: string;
|
|
outline?: boolean;
|
|
backdropString: string;
|
|
}
|
|
|
|
const Backdrop = ({
|
|
src,
|
|
color = 'red',
|
|
outline = true,
|
|
backdropString,
|
|
}: BackdropProps): JSX.Element => {
|
|
const id = React.useId();
|
|
return (
|
|
<>
|
|
<defs xmlns="http://www.w3.org/2000/svg">
|
|
<pattern
|
|
id={`pattern-${id}`}
|
|
width=".1"
|
|
height=".1"
|
|
patternUnits="userSpaceOnUse"
|
|
patternTransform="rotate(45 50 50)"
|
|
>
|
|
<line
|
|
stroke={color}
|
|
strokeWidth={0.1}
|
|
y2={1}
|
|
/>
|
|
<line
|
|
stroke={color}
|
|
strokeWidth={0.1}
|
|
y2={1}
|
|
/>
|
|
</pattern>
|
|
</defs>
|
|
<mask
|
|
id={`svg-preview-backdrop-mask-${id}`}
|
|
maskUnits="userSpaceOnUse"
|
|
>
|
|
<g
|
|
stroke="#fff"
|
|
dangerouslySetInnerHTML={{ __html: backdropString }}
|
|
/>
|
|
<g dangerouslySetInnerHTML={{ __html: src }} />
|
|
</mask>
|
|
<mask
|
|
id={`svg-preview-backdrop-mask-outline-${id}`}
|
|
maskUnits="userSpaceOnUse"
|
|
>
|
|
<rect
|
|
x="0"
|
|
y="0"
|
|
width="100%"
|
|
height="100%"
|
|
fill="#fff"
|
|
stroke="none"
|
|
/>
|
|
<g
|
|
strokeWidth={1.75}
|
|
dangerouslySetInnerHTML={{ __html: backdropString }}
|
|
/>
|
|
</mask>
|
|
<g mask={`url(#svg-preview-backdrop-mask-${id})`}>
|
|
<rect
|
|
x="0"
|
|
y="0"
|
|
width="100%"
|
|
height="100%"
|
|
opacity={0.5}
|
|
fill={`url(#pattern-${id})`}
|
|
stroke="none"
|
|
/>
|
|
<g
|
|
stroke={color}
|
|
strokeWidth={2.25}
|
|
opacity={0.75}
|
|
dangerouslySetInnerHTML={{ __html: src }}
|
|
/>
|
|
{outline && (
|
|
<g
|
|
stroke={color}
|
|
strokeWidth={2.25}
|
|
opacity={0.75}
|
|
mask={`url(#svg-preview-backdrop-mask-outline-${id})`}
|
|
dangerouslySetInnerHTML={{ __html: backdropString }}
|
|
/>
|
|
)}
|
|
</g>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Backdrop;
|