mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
28 lines
504 B
TypeScript
28 lines
504 B
TypeScript
// @ts-nocheck
|
|
import React, { useMemo } from 'react';
|
|
import '@/style/components/Skeleton.scss';
|
|
|
|
import { randomNumber } from '@/utils';
|
|
|
|
/**
|
|
* Skeleton component.
|
|
*/
|
|
export function Skeleton({
|
|
Tag = 'span',
|
|
minWidth = 40,
|
|
maxWidth = 100,
|
|
children,
|
|
}) {
|
|
const randomWidth = useMemo(
|
|
() => randomNumber(minWidth, maxWidth),
|
|
[minWidth, maxWidth],
|
|
);
|
|
return (
|
|
<Tag
|
|
className={'skeleton'}
|
|
style={{ width: `${randomWidth}%` }}
|
|
children={children}
|
|
/>
|
|
);
|
|
}
|