File size: 604 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import clsx from 'clsx';
import React from 'react';

import './style.scss';

interface Props extends React.HTMLAttributes< HTMLDivElement > {
	shape?: 'circle' | 'rect';
	height?: string;
	width?: string;
}

const Skeleton = ( { shape = 'rect', height, width, style, className, ...rest }: Props ) => {
	const classes = clsx(
		'skeleton',
		{
			'skeleton--circle': shape === 'circle',
		},
		className
	);

	const styles = {
		...style,
		...( height && { height } ),
		...( width && { width } ),
	};

	return <div { ...rest } className={ classes } style={ styles }></div>;
};

export default Skeleton;