Files
FastGPT/packages/web/components/common/MyBox/index.tsx
Archer 19c8a06d51 Permission (#1687)
Co-authored-by: Archer <545436317@qq.com>
Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
2024-06-04 17:52:00 +08:00

21 lines
557 B
TypeScript

import React, { forwardRef } from 'react';
import { Box, BoxProps, SpinnerProps } from '@chakra-ui/react';
import Loading from '../MyLoading';
type Props = BoxProps & {
isLoading?: boolean;
text?: string;
size?: SpinnerProps['size'];
};
const MyBox = ({ text, isLoading, children, size, ...props }: Props, ref: any) => {
return (
<Box ref={ref} position={isLoading ? 'relative' : 'unset'} {...props}>
{isLoading && <Loading fixed={false} text={text} size={size} />}
{children}
</Box>
);
};
export default forwardRef(MyBox);