@j2inn/app-react
Version:
React implementation of the j2inn-app framework
26 lines (25 loc) • 901 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Container, Spin } from '@j2inn/ui';
const containerStyle = {
flex: '1 1 auto',
minWidth: 300,
minHeight: 300,
};
const centeredContainerStyle = {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%',
};
const Loading = ({ children, style, padded = false, centered = false, delay = 666, immediate, ...props }) => {
const spinner = (_jsx(Spin, { delay: immediate ? 0 : delay, style: style, ...props, children: children }));
if (padded) {
return (_jsx(Container, { middle: true, center: true, style: { ...containerStyle, ...style }, ...props, children: spinner }));
}
if (centered) {
return (_jsx(Container, { style: { ...centeredContainerStyle, ...style }, ...props, children: spinner }));
}
return spinner;
};
export { Loading };