-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(partners): add grid pattern background
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use client"; | ||
|
||
import { cn } from "@umamin/ui/lib/utils"; | ||
import { useId } from "react"; | ||
|
||
interface GridPatternProps { | ||
width?: any; | ||
height?: any; | ||
x?: any; | ||
y?: any; | ||
squares?: Array<[x: number, y: number]>; | ||
strokeDasharray?: any; | ||
className?: string; | ||
[key: string]: any; | ||
} | ||
|
||
export function GridPattern({ | ||
width = 40, | ||
height = 40, | ||
x = -1, | ||
y = -1, | ||
strokeDasharray = 0, | ||
squares, | ||
className, | ||
...props | ||
}: GridPatternProps) { | ||
const id = useId(); | ||
|
||
return ( | ||
<svg | ||
aria-hidden="true" | ||
className={cn( | ||
"pointer-events-auto absolute inset-0 h-full w-full fill-gray-400/20 stroke-gray-400/5", | ||
className | ||
)} | ||
{...props} | ||
> | ||
<defs> | ||
<pattern | ||
id={id} | ||
width={width} | ||
height={height} | ||
patternUnits="userSpaceOnUse" | ||
x={x} | ||
y={y} | ||
> | ||
<path | ||
d={`M.5 ${height}V.5H${width}`} | ||
fill="none" | ||
strokeDasharray={strokeDasharray} | ||
/> | ||
</pattern> | ||
</defs> | ||
<rect width="100%" height="100%" strokeWidth={0} fill={`url(#${id})`} /> | ||
</svg> | ||
); | ||
} | ||
|
||
export default GridPattern; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters