Files
bigcapital/packages/webapp/src/components/Skeleton/SkeletonText.tsx
2023-02-03 01:02:31 +02:00

21 lines
511 B
TypeScript

// @ts-nocheck
import React, { useMemo } from 'react';
import '@/style/components/Skeleton.scss';
import { randomNumber } from '@/utils';
export function SkeletonText({
Tag = 'span',
charsLength,
minChars = 40,
maxChars = 100,
}) {
const computedCharLength = useMemo(
() => (charsLength ? charsLength : randomNumber(minChars, maxChars)),
[charsLength, minChars, maxChars],
);
const randamText = 'X'.repeat(computedCharLength);
return <Tag className={'skeleton'}>{randamText}</Tag>;
}