This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace gsap animations with CSS transitions
- Loading branch information
1 parent
55ab973
commit e8cf1a9
Showing
5 changed files
with
77 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,44 @@ | ||
import type { SVGProps } from 'react'; | ||
import { styled } from '../../stitches.config'; | ||
import { easeOutExpo, easeInQuad } from '../primitives/animation'; | ||
|
||
const Path = styled('path', { | ||
'input:checked ~ div &': { | ||
transition: 'stroke-dashoffset 1s cubic-bezier(0.16, 1, 0.3, 1)', | ||
transition: `stroke-dashoffset 0.2s ${easeInQuad}`, | ||
variants: { | ||
isChecked: { | ||
true: { | ||
transition: `stroke-dashoffset 1s ${easeOutExpo}`, | ||
}, | ||
}, | ||
}, | ||
transition: 'stroke-dashoffset 0.2s cubic-bezier(0.11, 0, 0.5, 0)', | ||
}); | ||
|
||
export const CheckIcon = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg | ||
fill="none" | ||
focusable="false" | ||
height="1em" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="1em" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...props} | ||
> | ||
<Path | ||
d="M0.709339 7.44716L5.70834 12.4462L15.3004 2.8541" | ||
stroke="currentColor" | ||
strokeDasharray="21 21" | ||
strokeMiterlimit="10" | ||
strokeWidth="2" | ||
/> | ||
</svg> | ||
); | ||
type CheckIconProps = SVGProps<SVGSVGElement> & { | ||
isChecked?: boolean; | ||
}; | ||
|
||
export const CheckIcon = (props: CheckIconProps) => { | ||
const { isChecked, ...svgProps } = props; | ||
|
||
return ( | ||
<svg | ||
fill="none" | ||
focusable="false" | ||
height="1em" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
width="1em" | ||
xmlns="http://www.w3.org/2000/svg" | ||
{...svgProps} | ||
> | ||
<Path | ||
d="M0.709339 7.44716L5.70834 12.4462L15.3004 2.8541" | ||
isChecked={isChecked} | ||
stroke="currentColor" | ||
strokeDasharray="21 21" | ||
strokeMiterlimit="10" | ||
strokeWidth="2" | ||
/> | ||
</svg> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Easing | ||
export const easeInQuad = 'cubic-bezier(0.55, 0.085, 0.68, 0.53)'; | ||
export const easeInCubic = 'cubic-bezier(0.55, 0.055, 0.675, 0.19)'; | ||
export const easeInQuart = 'cubic-bezier(0.895, 0.03, 0.685, 0.22)'; | ||
export const easeInQuint = 'cubic-bezier(0.755, 0.05, 0.855, 0.06)'; | ||
export const easeInExpo = 'cubic-bezier(0.95, 0.05, 0.795, 0.035)'; | ||
export const easeInCirc = 'cubic-bezier(0.6, 0.04, 0.98, 0.335)'; | ||
export const easeOutQuad = 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'; | ||
export const easeOutCubic = 'cubic-bezier(0.215, 0.61, 0.355, 1)'; | ||
export const easeOutQuart = 'cubic-bezier(0.165, 0.84, 0.44, 1)'; | ||
export const easeOutQuint = 'cubic-bezier(0.23, 1, 0.32, 1)'; | ||
export const easeOutExpo = 'cubic-bezier(0.19, 1, 0.22, 1)'; | ||
export const easeOutCirc = 'cubic-bezier(0.075, 0.82, 0.165, 1)'; | ||
export const easeInOutQuad = 'cubic-bezier(0.455, 0.03, 0.515, 0.955)'; | ||
export const easeInOutCubic = 'cubic-bezier(0.645, 0.045, 0.355, 1)'; | ||
export const easeInOutQuart = 'cubic-bezier(0.77, 0, 0.175, 1)'; | ||
export const easeInOutQuint = 'cubic-bezier(0.86, 0, 0.07, 1)'; | ||
export const easeInOutExpo = 'cubic-bezier(1, 0, 0, 1)'; | ||
export const easeInOutCirc = 'cubic-bezier(0.785, 0.135, 0.15, 0.86)'; |
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