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
102 lines
3.5 KiB
JavaScript
102 lines
3.5 KiB
JavaScript
import * as React from 'react';
|
|
import { styled } from '@mui/material/styles';
|
|
import FormatAlignLeftIcon from '@mui/icons-material/FormatAlignLeft';
|
|
import FormatAlignCenterIcon from '@mui/icons-material/FormatAlignCenter';
|
|
import FormatAlignRightIcon from '@mui/icons-material/FormatAlignRight';
|
|
import FormatAlignJustifyIcon from '@mui/icons-material/FormatAlignJustify';
|
|
import FormatBoldIcon from '@mui/icons-material/FormatBold';
|
|
import FormatItalicIcon from '@mui/icons-material/FormatItalic';
|
|
import FormatUnderlinedIcon from '@mui/icons-material/FormatUnderlined';
|
|
import FormatColorFillIcon from '@mui/icons-material/FormatColorFill';
|
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
import Divider from '@mui/material/Divider';
|
|
import Paper from '@mui/material/Paper';
|
|
import ToggleButton from '@mui/material/ToggleButton';
|
|
import ToggleButtonGroup, {
|
|
toggleButtonGroupClasses,
|
|
} from '@mui/material/ToggleButtonGroup';
|
|
|
|
const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }) => ({
|
|
[`& .${toggleButtonGroupClasses.grouped}`]: {
|
|
margin: theme.spacing(0.5),
|
|
border: 0,
|
|
borderRadius: theme.shape.borderRadius,
|
|
[`&.${toggleButtonGroupClasses.disabled}`]: {
|
|
border: 0,
|
|
},
|
|
},
|
|
[`& .${toggleButtonGroupClasses.middleButton},& .${toggleButtonGroupClasses.lastButton}`]:
|
|
{
|
|
marginLeft: -1,
|
|
borderLeft: '1px solid transparent',
|
|
},
|
|
}));
|
|
|
|
export default function CustomizedDividers() {
|
|
const [alignment, setAlignment] = React.useState('left');
|
|
const [formats, setFormats] = React.useState(() => ['italic']);
|
|
|
|
const handleFormat = (event, newFormats) => {
|
|
setFormats(newFormats);
|
|
};
|
|
|
|
const handleAlignment = (event, newAlignment) => {
|
|
setAlignment(newAlignment);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Paper
|
|
elevation={0}
|
|
sx={(theme) => ({
|
|
display: 'flex',
|
|
border: `1px solid ${theme.palette.divider}`,
|
|
flexWrap: 'wrap',
|
|
})}
|
|
>
|
|
<StyledToggleButtonGroup
|
|
size="small"
|
|
value={alignment}
|
|
exclusive
|
|
onChange={handleAlignment}
|
|
aria-label="text alignment"
|
|
>
|
|
<ToggleButton value="left" aria-label="left aligned">
|
|
<FormatAlignLeftIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="center" aria-label="centered">
|
|
<FormatAlignCenterIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="right" aria-label="right aligned">
|
|
<FormatAlignRightIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="justify" aria-label="justified" disabled>
|
|
<FormatAlignJustifyIcon />
|
|
</ToggleButton>
|
|
</StyledToggleButtonGroup>
|
|
<Divider flexItem orientation="vertical" sx={{ mx: 0.5, my: 1 }} />
|
|
<StyledToggleButtonGroup
|
|
size="small"
|
|
value={formats}
|
|
onChange={handleFormat}
|
|
aria-label="text formatting"
|
|
>
|
|
<ToggleButton value="bold" aria-label="bold">
|
|
<FormatBoldIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="italic" aria-label="italic">
|
|
<FormatItalicIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="underlined" aria-label="underlined">
|
|
<FormatUnderlinedIcon />
|
|
</ToggleButton>
|
|
<ToggleButton value="color" aria-label="color" disabled>
|
|
<FormatColorFillIcon />
|
|
<ArrowDropDownIcon />
|
|
</ToggleButton>
|
|
</StyledToggleButtonGroup>
|
|
</Paper>
|
|
</div>
|
|
);
|
|
}
|