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

87 lines
1.9 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 BellProps = IconProps<keyof typeof animations>;
const animations = {
default: {
group: {
initial: {
rotate: 0,
},
animate: {
rotate: [0, 20, -10, 10, -5, 3, 0],
transformOrigin: 'top center',
transition: { duration: 0.9, ease: 'easeInOut' },
},
},
path1: {
initial: {
x: 0,
},
animate: {
x: [0, -6, 5, -5, 4, -3, 2, 0],
transition: { duration: 1.1, ease: 'easeInOut' },
},
},
path2: {},
} satisfies Record<string, Variants>,
} as const;
function IconComponent({ size, ...props }: BellProps) {
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"
variants={variants.group}
initial="initial"
animate={controls}
{...props}
>
<motion.path
d="M10.268 21a2 2 0 0 0 3.464 0"
variants={variants.path1}
initial="initial"
animate={controls}
/>
<motion.path
d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"
variants={variants.path2}
initial="initial"
animate={controls}
/>
</motion.svg>
);
}
function Bell(props: BellProps) {
return <IconWrapper icon={IconComponent} {...props} />;
}
export {
animations,
Bell,
Bell as BellIcon,
type BellProps,
type BellProps as BellIconProps,
};