163 lines
3.5 KiB
TypeScript
163 lines
3.5 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 MoveUpProps = IconProps<keyof typeof animations>;
|
|
|
|
const animations = {
|
|
default: {
|
|
group1: {
|
|
initial: {
|
|
y: 0,
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
animate: {
|
|
y: '-15%',
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
},
|
|
group2: {},
|
|
path1: {},
|
|
path2: {},
|
|
} satisfies Record<string, Variants>,
|
|
'default-loop': {
|
|
group1: {
|
|
initial: {
|
|
y: 0,
|
|
},
|
|
animate: {
|
|
y: [0, '-15%', 0],
|
|
transition: { ease: 'easeInOut', duration: 0.6 },
|
|
},
|
|
},
|
|
group2: {},
|
|
path1: {},
|
|
path2: {},
|
|
} satisfies Record<string, Variants>,
|
|
pointing: {
|
|
group1: {},
|
|
group2: {},
|
|
path1: {
|
|
initial: {
|
|
d: 'M12 2V22',
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
animate: {
|
|
d: 'M12 12V22',
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
},
|
|
path2: {
|
|
initial: {
|
|
d: 'M8 6L12 2L16 6',
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
animate: {
|
|
d: 'M8 16L12 12L16 16',
|
|
transition: { ease: 'easeInOut', duration: 0.3 },
|
|
},
|
|
},
|
|
} satisfies Record<string, Variants>,
|
|
'pointing-loop': {
|
|
group1: {},
|
|
group2: {},
|
|
path1: {
|
|
initial: {
|
|
d: 'M12 2V22',
|
|
},
|
|
animate: {
|
|
d: ['M12 2V22', 'M12 12V22', 'M12 2V22'],
|
|
transition: { ease: 'easeInOut', duration: 0.6 },
|
|
},
|
|
},
|
|
path2: {
|
|
initial: {
|
|
d: 'M8 6L12 2L16 6',
|
|
},
|
|
animate: {
|
|
d: ['M8 6L12 2L16 6', 'M8 16L12 12L16 16', 'M8 6L12 2L16 6'],
|
|
transition: { ease: 'easeInOut', duration: 0.6 },
|
|
},
|
|
},
|
|
} satisfies Record<string, Variants>,
|
|
out: {
|
|
group1: {},
|
|
group2: {
|
|
initial: {
|
|
y: 0,
|
|
},
|
|
animate: {
|
|
y: [0, '-150%', '150%', 0],
|
|
transition: {
|
|
default: { ease: 'easeInOut', duration: 0.8 },
|
|
y: {
|
|
ease: 'easeInOut',
|
|
duration: 0.8,
|
|
times: [0, 0.5, 0.5, 1],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
path1: {},
|
|
path2: {},
|
|
} satisfies Record<string, Variants>,
|
|
} as const;
|
|
|
|
function IconComponent({ size, ...props }: MoveUpProps) {
|
|
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.group1}
|
|
initial="initial"
|
|
animate={controls}
|
|
{...props}
|
|
>
|
|
<motion.g variants={variants.group2} initial="initial" animate={controls}>
|
|
<motion.path
|
|
d="M12 2V22"
|
|
variants={variants.path1}
|
|
initial="initial"
|
|
animate={controls}
|
|
/>
|
|
<motion.path
|
|
d="M8 6L12 2L16 6"
|
|
variants={variants.path2}
|
|
initial="initial"
|
|
animate={controls}
|
|
/>
|
|
</motion.g>
|
|
</motion.svg>
|
|
);
|
|
}
|
|
|
|
function MoveUp(props: MoveUpProps) {
|
|
return <IconWrapper icon={IconComponent} {...props} />;
|
|
}
|
|
|
|
export {
|
|
animations,
|
|
MoveUp,
|
|
MoveUp as MoveUpIcon,
|
|
type MoveUpProps,
|
|
type MoveUpProps as MoveUpIconProps,
|
|
};
|