Files
react-test/docs/data/joy/components/card/UserCard.tsx
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

126 lines
3.7 KiB
TypeScript

import AspectRatio from '@mui/joy/AspectRatio';
import Box from '@mui/joy/Box';
import Button from '@mui/joy/Button';
import Card from '@mui/joy/Card';
import CardContent from '@mui/joy/CardContent';
import Typography from '@mui/joy/Typography';
import Sheet from '@mui/joy/Sheet';
export default function UserCard() {
return (
<Box
sx={{
width: '100%',
position: 'relative',
overflow: { xs: 'auto', sm: 'initial' },
}}
>
<Box
sx={{
position: 'absolute',
display: 'block',
width: '1px',
bgcolor: 'warning.300',
left: '500px',
top: '-24px',
bottom: '-24px',
'&::before': {
top: '4px',
content: '"vertical"',
display: 'block',
position: 'absolute',
right: '0.5rem',
color: 'text.tertiary',
fontSize: 'sm',
fontWeight: 'lg',
},
'&::after': {
top: '4px',
content: '"horizontal"',
display: 'block',
position: 'absolute',
left: '0.5rem',
color: 'text.tertiary',
fontSize: 'sm',
fontWeight: 'lg',
},
}}
/>
<Card
orientation="horizontal"
sx={{
width: '100%',
flexWrap: 'wrap',
[`& > *`]: {
'--stack-point': '500px',
minWidth:
'clamp(0px, (calc(var(--stack-point) - 2 * var(--Card-padding) - 2 * var(--variant-borderWidth, 0px)) + 1px - 100%) * 999, 100%)',
},
// make the card resizable for demo
overflow: 'auto',
resize: 'horizontal',
}}
>
<AspectRatio flex ratio="1" maxHeight={182} sx={{ minWidth: 182 }}>
<img
src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286"
srcSet="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=286&dpr=2 2x"
loading="lazy"
alt=""
/>
</AspectRatio>
<CardContent>
<Typography sx={{ fontSize: 'xl', fontWeight: 'lg' }}>
Alex Morrison
</Typography>
<Typography
level="body-sm"
textColor="text.tertiary"
sx={{ fontWeight: 'lg' }}
>
Senior Journalist
</Typography>
<Sheet
sx={{
bgcolor: 'background.level1',
borderRadius: 'sm',
p: 1.5,
my: 1.5,
display: 'flex',
gap: 2,
'& > div': { flex: 1 },
}}
>
<div>
<Typography level="body-xs" sx={{ fontWeight: 'lg' }}>
Articles
</Typography>
<Typography sx={{ fontWeight: 'lg' }}>34</Typography>
</div>
<div>
<Typography level="body-xs" sx={{ fontWeight: 'lg' }}>
Followers
</Typography>
<Typography sx={{ fontWeight: 'lg' }}>980</Typography>
</div>
<div>
<Typography level="body-xs" sx={{ fontWeight: 'lg' }}>
Rating
</Typography>
<Typography sx={{ fontWeight: 'lg' }}>8.9</Typography>
</div>
</Sheet>
<Box sx={{ display: 'flex', gap: 1.5, '& > button': { flex: 1 } }}>
<Button variant="outlined" color="neutral">
Chat
</Button>
<Button variant="solid" color="primary">
Follow
</Button>
</Box>
</CardContent>
</Card>
</Box>
);
}