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"
|
||||
|
||||
const variants = cva(styles.shimmer, {
|
||||
variants: {
|
||||
contrast: {
|
||||
light: styles.light,
|
||||
dark: styles.dark,
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
contrast: "light",
|
||||
},
|
||||
})
|
||||
|
||||
export default function SkeletonShimmer({
|
||||
height,
|
||||
width,
|
||||
@@ -11,7 +25,7 @@ export default function SkeletonShimmer({
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={`${styles.shimmer} ${styles[contrast]}`}
|
||||
className={variants({ contrast })}
|
||||
style={{
|
||||
height: height,
|
||||
width: width,
|
||||
|
||||
Reference in New Issue
Block a user