Last active
May 24, 2023 14:31
-
-
Save jackbkennedy/2049027629ab0e0bacfb95108027c49b to your computer and use it in GitHub Desktop.
stitches-spinner
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
// Full code - https://github.com/jackbkennedy/stitches-spinner | |
import { styled, keyframes } from "../stitches.config"; | |
const spinner = keyframes({ | |
to: { | |
transform: "rotate(360deg)", | |
}, | |
}); | |
export const Spinner = styled("div", { | |
dispaly: "inline-block", | |
width: "10px", | |
height: "10px", | |
borderWidth: 2, | |
borderStyle: "solid", | |
borderColor: "white", | |
borderRadius: "$radii$round", | |
animation: `${spinner} .6s linear infinite`, | |
// define stitches variants using values from sticthes.config.ts | |
variants: { | |
color: { | |
gray: { | |
borderTopColor: "$gray8", | |
}, | |
blue: { | |
borderTopColor: "$blue8", | |
}, | |
red: { | |
borderTopColor: "$red8", | |
}, | |
green: { | |
borderTopColor: "$green8", | |
}, | |
purple: { | |
borderTopColor: "$purple8", | |
}, | |
}, | |
size: { | |
"1": { | |
size: "$2", | |
height: "$2", | |
}, | |
"2": { | |
width: "$4", | |
height: "$4", | |
}, | |
"3": { | |
width: "$6", | |
height: "$6", | |
}, | |
"4": { | |
width: "$8", | |
height: "$8", | |
}, | |
}, | |
thickness: { | |
"1": { | |
borderWidth: 2, | |
}, | |
"2": { | |
borderWidth: 4, | |
}, | |
"3": { | |
borderWidth: 6, | |
}, | |
"4": { | |
borderWidth: 8, | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment