Use cva for SkeletonShimmer class variants
This commit is contained in:
@@ -1,5 +1,19 @@
|
|||||||
|
import { cva } from "class-variance-authority"
|
||||||
|
|
||||||
import styles from "./skeleton.module.css"
|
import styles from "./skeleton.module.css"
|
||||||
|
|
||||||
|
const variants = cva(styles.shimmer, {
|
||||||
|
variants: {
|
||||||
|
contrast: {
|
||||||
|
light: styles.light,
|
||||||
|
dark: styles.dark,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
contrast: "light",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
export default function SkeletonShimmer({
|
export default function SkeletonShimmer({
|
||||||
height,
|
height,
|
||||||
width,
|
width,
|
||||||
@@ -11,7 +25,7 @@ export default function SkeletonShimmer({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`${styles.shimmer} ${styles[contrast]}`}
|
className={variants({ contrast })}
|
||||||
style={{
|
style={{
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
|
|||||||
Reference in New Issue
Block a user