Files
react-test/docs/data/system/components/grid/AutoGridNoWrap.js
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

54 lines
1.5 KiB
JavaScript

import Box from '@mui/system/Box';
import Grid from '@mui/system/Grid';
import styled from '@mui/system/styled';
import Avatar from '@mui/material/Avatar';
import Typography from '@mui/material/Typography';
const Item = styled('div')(({ theme }) => ({
border: '1px solid',
borderColor: '#ced7e0',
borderRadius: 4,
...theme.applyStyles('dark', {
borderColor: '#444d58',
}),
}));
const message = `Truncation should be conditionally applicable on this long line of text
as this is a much longer line than what the container can support. `;
export default function AutoGridNoWrap() {
return (
<Box sx={{ flexGrow: 1, overflow: 'hidden', px: 3, maxWidth: 400 }}>
<Item sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container wrap="nowrap" spacing={2}>
<Grid>
<Avatar>W</Avatar>
</Grid>
<Grid size="grow">
<Typography noWrap>{message}</Typography>
</Grid>
</Grid>
</Item>
<Item sx={{ my: 1, mx: 'auto', p: 2 }}>
<Grid container wrap="nowrap" spacing={2}>
<Grid>
<Avatar>W</Avatar>
</Grid>
<Grid size="grow">
<Typography
sx={{
display: '-webkit-box',
WebkitLineClamp: '3',
WebkitBoxOrient: 'vertical',
overflow: 'hidden',
}}
>
{message}
</Typography>
</Grid>
</Grid>
</Item>
</Box>
);
}