mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
Since we load directly from Stripe, it takes a little time. Good to have skeletons. <img width="2151" height="1587" alt="Screenshot from 2025-10-17 15-32-10" src="https://github.com/user-attachments/assets/be767ea1-b95f-4ef3-abf6-e8302e7092fd" />
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import {
|
|
styled,
|
|
Accordion,
|
|
AccordionSummary,
|
|
AccordionDetails,
|
|
} from '@mui/material';
|
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
|
const StyledAccordion = styled(Accordion)(({ theme }) => ({
|
|
background: theme.palette.background.paper,
|
|
borderRadius: theme.shape.borderRadiusLarge,
|
|
}));
|
|
|
|
const HeaderRoot = styled(AccordionSummary)(({ theme }) => ({
|
|
padding: theme.spacing(2, 4),
|
|
gap: theme.spacing(1.5),
|
|
}));
|
|
|
|
const HeaderLeft = styled('div')(({ theme }) => ({
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: theme.spacing(1.5),
|
|
flex: 1,
|
|
minWidth: 0,
|
|
}));
|
|
|
|
const HeaderRight = styled('div')(({ theme }) => ({
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: theme.spacing(2),
|
|
}));
|
|
|
|
const SkeletonBox = styled('div')(({ theme }) => ({
|
|
height: theme.spacing(2.5),
|
|
backgroundColor: theme.palette.action.hover,
|
|
borderRadius: theme.spacing(0.5),
|
|
margin: theme.spacing(0.5, 0),
|
|
}));
|
|
|
|
const SkeletonBadge = styled('div')(({ theme }) => ({
|
|
height: theme.spacing(3),
|
|
width: theme.spacing(10),
|
|
backgroundColor: theme.palette.action.hover,
|
|
borderRadius: theme.spacing(1.5),
|
|
}));
|
|
|
|
const SkeletonAmount = styled('div')(({ theme }) => ({
|
|
height: theme.spacing(3),
|
|
width: theme.spacing(12.5),
|
|
backgroundColor: theme.palette.action.hover,
|
|
borderRadius: theme.spacing(0.5),
|
|
}));
|
|
|
|
const SkeletonContent = styled('div')(({ theme }) => ({
|
|
height: theme.spacing(25),
|
|
backgroundColor: theme.palette.action.hover,
|
|
borderRadius: theme.spacing(0.5),
|
|
margin: theme.spacing(2, 4),
|
|
}));
|
|
|
|
export const BillingInvoiceSkeleton = () => {
|
|
return (
|
|
<StyledAccordion defaultExpanded data-loading>
|
|
<HeaderRoot expandIcon={<ExpandMoreIcon />}>
|
|
<HeaderLeft>
|
|
<SkeletonBox
|
|
sx={{
|
|
width: (theme) => theme.spacing(15),
|
|
height: (theme) => theme.spacing(4),
|
|
}}
|
|
/>
|
|
</HeaderLeft>
|
|
<HeaderRight>
|
|
<SkeletonBadge />
|
|
<SkeletonAmount />
|
|
</HeaderRight>
|
|
</HeaderRoot>
|
|
<AccordionDetails>
|
|
<SkeletonContent />
|
|
</AccordionDetails>
|
|
</StyledAccordion>
|
|
);
|
|
};
|