captains-log/frontend/app/components/LoadingSpinner.tsx
Drew Galbraith d60d834f38 Create a frontend wireframe. (#7)
Sets up API methods and types.
Sets up a colorscheme.
Sets up a homepage.

Removes tailwind in favor of mui for now.

Reviewed-on: #7
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
2025-09-23 04:08:45 +00:00

53 lines
1.2 KiB
TypeScript

import React from 'react'
import { Box, CircularProgress, Typography, Skeleton } from '@mui/material'
interface LoadingSpinnerProps {
size?: number
message?: string
variant?: 'spinner' | 'skeleton'
}
export default function LoadingSpinner({
size = 40,
message = 'Loading...',
variant = 'spinner',
}: LoadingSpinnerProps) {
if (variant === 'skeleton') {
return (
<Box sx={{ p: 2 }}>
<Skeleton variant="text" width="60%" height={32} sx={{ mb: 2 }} />
<Skeleton
variant="rectangular"
width="100%"
height={120}
sx={{ mb: 1 }}
/>
<Skeleton
variant="rectangular"
width="100%"
height={120}
sx={{ mb: 1 }}
/>
<Skeleton variant="rectangular" width="100%" height={120} />
</Box>
)
}
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
p: 4,
gap: 2,
}}
>
<CircularProgress size={size} thickness={4} />
<Typography variant="body2" color="text.secondary">
{message}
</Typography>
</Box>
)
}