feat: add loading

This commit is contained in:
2024-11-28 01:02:56 +08:00
parent c5a509e4e8
commit 99cfa7f34d
11 changed files with 133 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
type LoadingProps = {
loading?: boolean;
children?: React.ReactNode;
};
export const Loading = (props: LoadingProps) => {
if (!props.loading) return <>{props.children}</>;
return (
<div className='w-full h-full flex justify-center items-center'>
<div className='w-20 h-20 border-t-8 border-b-8 rounded-full animate-spin'></div>
</div>
);
};
type ShowContentProps = {
className: string;
open?: boolean;
children?: React.ReactNode;
blank?: React.ReactNode;
};
export const LoadContent = (props: ShowContentProps) => {
let open = props.open ?? true;
if (open) return <>{props.children}</>;
return <div className={props.className}>{props?.blank}</div>;
};

View File

@@ -0,0 +1 @@
export * from './Load';