2025-08-20 04:12:49 -06:00

162 lines
3.0 KiB
TypeScript

'use client';
import * as React from 'react';
import { motion, type Variants } from 'motion/react';
import {
getVariants,
useAnimateIconContext,
IconWrapper,
type IconProps,
} from '@/registry/icons/icon';
type UsersProps = IconProps<keyof typeof animations>;
const animations = {
default: {
path1: {
initial: {
y: 0,
},
animate: {
y: [0, 2, -2, 0],
transition: {
duration: 0.6,
ease: 'easeInOut',
delay: 0.1,
},
},
},
path2: {
initial: {
y: 0,
},
animate: {
y: [0, 4, -2, 0],
transition: {
duration: 0.6,
ease: 'easeInOut',
},
},
},
path3: {
initial: {
y: 0,
},
animate: {
y: [0, 2, -2, 0],
transition: {
duration: 0.6,
ease: 'easeInOut',
},
},
},
circle: {
initial: {
y: 0,
},
animate: {
y: [0, 4, -2, 0],
transition: {
duration: 0.6,
ease: 'easeInOut',
delay: 0.1,
},
},
},
} satisfies Record<string, Variants>,
appear: {
path1: {},
path2: {
initial: {
x: -6,
opacity: 0,
},
animate: {
x: 0,
opacity: 1,
transition: {
type: 'spring',
stiffness: 100,
damping: 10,
},
},
},
path3: {
initial: {
x: -6,
opacity: 0,
},
animate: {
x: 0,
opacity: 1,
transition: {
type: 'spring',
stiffness: 100,
damping: 10,
},
},
},
circle: {},
} satisfies Record<string, Variants>,
} as const;
function IconComponent({ size, ...props }: UsersProps) {
const { controls } = useAnimateIconContext();
const variants = getVariants(animations);
return (
<motion.svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<motion.path
d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"
variants={variants.path1}
initial="initial"
animate={controls}
/>
<motion.path
d="M16 3.128a4 4 0 0 1 0 7.744"
variants={variants.path2}
initial="initial"
animate={controls}
/>
<motion.path
d="M22 21v-2a4 4 0 0 0-3-3.87"
variants={variants.path3}
initial="initial"
animate={controls}
/>
<motion.circle
cx={9}
cy={7}
r={4}
variants={variants.circle}
initial="initial"
animate={controls}
/>
</motion.svg>
);
}
function Users(props: UsersProps) {
return <IconWrapper icon={IconComponent} {...props} />;
}
export {
animations,
Users,
Users as UsersIcon,
type UsersProps,
type UsersProps as UsersIconProps,
};