27 lines
2.8 KiB
JSON
27 lines
2.8 KiB
JSON
{
|
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
"name": "star-icon",
|
|
"type": "registry:ui",
|
|
"title": "Star Icon",
|
|
"description": "Star icon component.",
|
|
"dependencies": [
|
|
"motion"
|
|
],
|
|
"files": [
|
|
{
|
|
"path": "registry/icons/star/index.tsx",
|
|
"content": "'use client';\n\nimport * as React from 'react';\nimport { motion, type Variants } from 'motion/react';\n\nimport {\n getVariants,\n useAnimateIconContext,\n IconWrapper,\n type IconProps,\n} from '@/components/animate-ui/icons/icon';\n\ntype StarProps = IconProps<keyof typeof animations>;\n\nconst animations = {\n default: {\n group: {\n initial: {\n scale: 1,\n },\n animate: {\n scale: [1, 0.9, 1.2, 1],\n transition: { duration: 0.6, ease: 'easeInOut' },\n },\n },\n path: {},\n } satisfies Record<string, Variants>,\n fill: {\n group: {\n initial: {\n scale: 1,\n },\n animate: {\n scale: [1, 0.9, 1.2, 1],\n transition: { duration: 0.6, ease: 'easeInOut' },\n },\n },\n path: {\n initial: {\n fill: 'currentColor',\n fillOpacity: 0,\n },\n animate: {\n fillOpacity: 1,\n transition: { delay: 0.2 },\n },\n },\n } satisfies Record<string, Variants>,\n} as const;\n\nfunction IconComponent({ size, ...props }: StarProps) {\n const { controls } = useAnimateIconContext();\n const variants = getVariants(animations);\n\n return (\n <motion.svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n variants={variants.group}\n initial=\"initial\"\n animate={controls}\n {...props}\n >\n <motion.path\n d=\"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z\"\n variants={variants.path}\n initial=\"initial\"\n animate={controls}\n />\n </motion.svg>\n );\n}\n\nfunction Star(props: StarProps) {\n return <IconWrapper icon={IconComponent} {...props} />;\n}\n\nexport {\n animations,\n Star,\n Star as StarIcon,\n type StarProps,\n type StarProps as StarIconProps,\n};\n",
|
|
"type": "registry:ui",
|
|
"target": "components/animate-ui/icons/star.tsx"
|
|
}
|
|
],
|
|
"meta": {
|
|
"keywords": [
|
|
"bookmark",
|
|
"favorite",
|
|
"like",
|
|
"review",
|
|
"rating"
|
|
]
|
|
}
|
|
} |