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
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
import * as React from 'react';
|
|
import AspectRatio from '@mui/joy/AspectRatio';
|
|
import Box from '@mui/joy/Box';
|
|
import Card from '@mui/joy/Card';
|
|
import Typography from '@mui/joy/Typography';
|
|
import FormControl from '@mui/joy/FormControl';
|
|
import FormLabel from '@mui/joy/FormLabel';
|
|
import Input from '@mui/joy/Input';
|
|
|
|
export default function FlexRowRatio() {
|
|
const [flexBasis, setFlexBasis] = React.useState(200);
|
|
return (
|
|
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
<Card
|
|
variant="outlined"
|
|
size="sm"
|
|
orientation="horizontal"
|
|
sx={{ gap: 2, minWidth: 300 }}
|
|
>
|
|
<AspectRatio
|
|
sx={[
|
|
{ overflow: 'auto' },
|
|
flexBasis ? { flexBasis: `${flexBasis}px` } : { flexBasis: null },
|
|
]}
|
|
>
|
|
<img
|
|
src="https://images.unsplash.com/photo-1502657877623-f66bf489d236?auto=format&fit=crop&w=800"
|
|
srcSet="https://images.unsplash.com/photo-1502657877623-f66bf489d236?auto=format&fit=crop&w=800&dpr=2 2x"
|
|
alt=""
|
|
/>
|
|
</AspectRatio>
|
|
<div>
|
|
<Typography level="title-sm">Yosemite National Park</Typography>
|
|
<Typography level="body-sm">California, USA</Typography>
|
|
</div>
|
|
</Card>
|
|
<br />
|
|
<FormControl sx={{ mx: 'auto', width: '100%' }}>
|
|
<FormLabel>flexBasis</FormLabel>
|
|
<Input
|
|
variant="outlined"
|
|
type="number"
|
|
placeholder="number"
|
|
value={flexBasis}
|
|
endDecorator="px"
|
|
onChange={(event) => setFlexBasis(event.target.valueAsNumber)}
|
|
/>
|
|
</FormControl>
|
|
</Box>
|
|
);
|
|
}
|