-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #359 from omnifed/358-docs-add-fadeindown-animation
docs: add fadeInDown animation
- Loading branch information
Showing
3 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
docs/app/preset/animation/components/animate-in-down-preview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use client' | ||
|
||
import { Button, Show } from '@cerberus-design/react' | ||
import { css } from '@cerberus/styled-system/css' | ||
import { hstack, vstack } from '@cerberus/styled-system/patterns' | ||
import { useCallback, useState } from 'react' | ||
|
||
export function AnimateInDownPreview() { | ||
const [animate, setAnimate] = useState<boolean>(false) | ||
|
||
const handleAnimateIn = useCallback(() => { | ||
setAnimate(true) | ||
setTimeout(() => { | ||
setAnimate(false) | ||
}, 1500) | ||
}, []) | ||
|
||
return ( | ||
<div | ||
className={hstack({ | ||
gap: '4', | ||
})} | ||
> | ||
<Button onClick={handleAnimateIn}>Animate In</Button> | ||
|
||
<div className={vstack()}> | ||
<Show when={animate}> | ||
<div | ||
className={css({ | ||
animationName: 'fadeInDown', | ||
animationDuration: '250ms', | ||
animationTimingFunction: 'ease-in', | ||
animationFillMode: 'forwards', | ||
opacity: '0', | ||
padding: '4', | ||
})} | ||
> | ||
<span>Default</span> | ||
</div> | ||
</Show> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters