mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
refactoring: migrating to react-query to manage service-side state.
This commit is contained in:
19
client/src/components/Skeleton.js
Normal file
19
client/src/components/Skeleton.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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}%` }} />;
|
||||
}
|
||||
Reference in New Issue
Block a user