mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
83 lines
1.7 KiB
TypeScript
83 lines
1.7 KiB
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { motion, type Variants } from 'motion/react';
|
|
|
|
import {
|
|
getVariants,
|
|
type IconProps,
|
|
IconWrapper,
|
|
useAnimateIconContext,
|
|
} from '@/components/animate-ui/icons/icon';
|
|
|
|
type CircleCheckProps = IconProps<keyof typeof animations>;
|
|
|
|
const animations = {
|
|
default: {
|
|
circle: {},
|
|
path: {
|
|
initial: {
|
|
pathLength: 1,
|
|
opacity: 1,
|
|
scale: 1,
|
|
},
|
|
animate: {
|
|
pathLength: [0, 1],
|
|
opacity: [0, 1],
|
|
scale: [1, 1.1, 1],
|
|
transition: {
|
|
duration: 0.6,
|
|
ease: 'easeInOut',
|
|
},
|
|
},
|
|
},
|
|
} satisfies Record<string, Variants>,
|
|
} as const;
|
|
|
|
function IconComponent({ size, ...props }: CircleCheckProps) {
|
|
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.circle
|
|
cx='12'
|
|
cy='12'
|
|
r='10'
|
|
variants={variants.circle}
|
|
initial='initial'
|
|
animate={controls}
|
|
/>
|
|
<motion.path
|
|
d='m9 12 2 2 4-4'
|
|
variants={variants.path}
|
|
initial='initial'
|
|
animate={controls}
|
|
/>
|
|
</motion.svg>
|
|
);
|
|
}
|
|
|
|
function CircleCheck(props: CircleCheckProps) {
|
|
return <IconWrapper icon={IconComponent} {...props} />;
|
|
}
|
|
|
|
export {
|
|
animations,
|
|
CircleCheck,
|
|
CircleCheck as CircleCheckIcon,
|
|
type CircleCheckProps,
|
|
type CircleCheckProps as CircleCheckIconProps,
|
|
};
|