mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
20 lines
429 B
JavaScript
20 lines
429 B
JavaScript
import React, { useMemo } from 'react';
|
|
import 'style/components/Skeleton.scss';
|
|
|
|
import { randomNumber } from 'utils';
|
|
|
|
/**
|
|
* Skeleton component.
|
|
*/
|
|
export default function Skeleton({
|
|
Tag = 'span',
|
|
minWidth = 40,
|
|
maxWidth = 100,
|
|
}) {
|
|
const randomWidth = useMemo(() => randomNumber(minWidth, maxWidth), [
|
|
minWidth,
|
|
maxWidth,
|
|
]);
|
|
return <Tag className={'skeleton'} style={{ width: `${randomWidth}%` }} />;
|
|
}
|