diff --git a/docs/src/app/Usage.tsx b/docs/src/app/Usage.tsx index 0b5fcfe6..0d977755 100644 --- a/docs/src/app/Usage.tsx +++ b/docs/src/app/Usage.tsx @@ -4,7 +4,7 @@ import { Button, Card, Sheet, Stack, Table, Typography } from '@mui/joy'; import Code from '@/design/components/Code'; -import ValkyrieIcon, { viArrowsRotateRight, viHeart, viMessageSmile, viSpinnerThird } from '@sippy-platform/valkyrie'; +import ValkyrieIcon, { viArrowsRotateRight, viHeart, viMessageSmile, viSpinner, viSpinnerThird } from '@sippy-platform/valkyrie'; export default function Usage() { const [rotate, setRotate] = useState(false); @@ -41,6 +41,14 @@ export default function Usage() { spin + + + + + + spin="pulse" + + @@ -55,8 +63,8 @@ export default function Usage() { Property name - Default - Description + Default + Description @@ -87,6 +95,15 @@ export default function Usage() { Number of times the animation is repeated. + + + --vi-animation-pulse-steps + + + 8 + + Number of steps when the spin property is set to pulse. + @@ -167,8 +184,8 @@ export default function Usage() { Property name - Default - Description + Default + Description @@ -271,8 +288,8 @@ export default function Usage() { Property name - Default - Description + Default + Description diff --git a/src/ValkyrieIcon.tsx b/src/ValkyrieIcon.tsx index 82b62c25..7a471ba9 100644 --- a/src/ValkyrieIcon.tsx +++ b/src/ValkyrieIcon.tsx @@ -6,7 +6,7 @@ interface ValkyrieProps { icon: IValkyrieIcon; rotate?: 0 | 90 | 180 | 270 | false; flip?: true | "x" | "y" | false; - spin?: boolean; + spin?: boolean | "pulse"; beat?: boolean; } @@ -68,21 +68,26 @@ export default function ValkyrieIcon({ animation-name: ${spinAnimation}; animation-timing-function: var(--vi-animation-timing-function, linear); animation-duration: var(--vi-animation-duration, 2s); - animation-iteration-count: var(--vi-animation-iteration-coun, infinite); + animation-iteration-count: var(--vi-animation-iteration-count, infinite); } `; + const spinPulseClass = css` + svg { + --vi-animation-timing-function: steps(var(--vi-animation-pulse-steps, 8)); + --vi-animation-duration: 1s; + } + ` + const beatClass = css ` svg { animation-name: ${beatAnimation}; animation-timing-function: var(--vi-animation-timing-function, ease-in-out); animation-duration: var(--vi-animation-duration, 1s); - animation-iteration-count: var(--vi-animation-iteration-coun, infinite); + animation-iteration-count: var(--vi-animation-iteration-count, infinite); } `; - console.log(beat); - return (
spin
spin="pulse"
--vi-animation-pulse-steps
8
pulse