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

118 lines
2.3 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 SquareKanbanProps = IconProps<keyof typeof animations>;
const animations = {
default: {
rect: {},
line1: {
initial: {
y2: 16,
},
animate: {
y2: [16, 11, 14, 16],
transition: { duration: 0.6, ease: 'linear' },
},
},
line2: {
initial: {
y2: 11,
},
animate: {
y2: [11, 14, 16, 11],
transition: { duration: 0.6, ease: 'linear' },
},
},
line3: {
initial: {
y2: 14,
},
animate: {
y2: [14, 16, 11, 14],
transition: { duration: 0.6, ease: 'linear' },
},
},
} satisfies Record<string, Variants>,
} as const;
function IconComponent({ size, ...props }: SquareKanbanProps) {
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.rect
x={3}
y={3}
width={18}
height={18}
rx={2}
ry={2}
variants={variants.rect}
initial="initial"
animate={controls}
/>
<motion.line
x1={16}
y1={7}
x2={16}
y2={16}
variants={variants.line1}
initial="initial"
animate={controls}
/>
<motion.line
x1={12}
y1={7}
x2={12}
y2={11}
variants={variants.line2}
initial="initial"
animate={controls}
/>
<motion.line
x1={8}
y1={7}
x2={8}
y2={14}
variants={variants.line3}
initial="initial"
animate={controls}
/>
</motion.svg>
);
}
function SquareKanban(props: SquareKanbanProps) {
return <IconWrapper icon={IconComponent} {...props} />;
}
export {
animations,
SquareKanban,
SquareKanban as SquareKanbanIcon,
type SquareKanbanProps,
type SquareKanbanProps as SquareKanbanIconProps,
};