diff --git a/src/components/UI/Skeleton/SGLSkeleton.tsx b/src/components/UI/Skeleton/SGLSkeleton.tsx new file mode 100644 index 0000000..d16f85c --- /dev/null +++ b/src/components/UI/Skeleton/SGLSkeleton.tsx @@ -0,0 +1,21 @@ +import Skeleton, { type SkeletonProps as MuiSkeletonProps } from '@mui/material/Skeleton' + +import type { CSSProperties } from '@mui/material/styles' +import { skeletonStyles } from './styles' + +interface SGLSkeletonProps extends Omit { + style?: CSSProperties +} + +export const SGLSkeleton = ({ animation = 'wave', style, ...props }: SGLSkeletonProps) => { + return ( + ({ + ...skeletonStyles(theme), + ...style, + })} + animation={animation} + {...props} + /> + ) +} diff --git a/src/components/UI/Skeleton/styles.ts b/src/components/UI/Skeleton/styles.ts new file mode 100644 index 0000000..af089dd --- /dev/null +++ b/src/components/UI/Skeleton/styles.ts @@ -0,0 +1,12 @@ +import type { Theme } from '@mui/material/styles' + +export const skeletonStyles = (theme: Theme) => { + return { + backgroundColor: theme.palette.lightGrey.main, + opacity: 1, + + '&.MuiSkeleton-wave::after': { + animationDuration: '1.6s', + }, + } +}