Last active
December 11, 2024 11:24
-
-
Save jacobparis/5657e2bcb1074b8bf39f19947d319a60 to your computer and use it in GitHub Desktop.
React Icon component
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
import { type IconName } from "#app/components/icons/icons.ts" | |
import href from "#app/components/icons/sprite.svg" | |
export function Icon({ | |
name, | |
className, | |
...props | |
}: React.SVGProps<SVGSVGElement> & { | |
name: IconName | |
}) { | |
return ( | |
<svg {...props} className={`inline self-center ${className}`}> | |
<use href={`${href}#${name}`} /> | |
</svg> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment