-
Notifications
You must be signed in to change notification settings - Fork 3
/
AlignHorizontal.tsx
64 lines (61 loc) · 1.47 KB
/
AlignHorizontal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import * as React from "react";
import {
FormatAlignCenter,
FormatAlignJustify,
FormatAlignLeft,
FormatAlignRight
} from "@mui/icons-material";
import { ToggleButton, ToggleButtonGroup } from "@mui/material";
import { AlignHorizontalProps } from "./AlignHorizontal.types";
/**
* Horizontal alignment button group component to toggle between left/center/right/justify alignment
*/
export default function AlignHorizontal({
disabled = false,
onChange,
orientation = "horizontal",
size = "medium",
value = "left"
}: AlignHorizontalProps) {
// return components
return (
<ToggleButtonGroup
aria-label="text alignment"
disabled={disabled}
exclusive
onChange={onChange}
orientation={orientation}
size={size}
value={value}
>
<ToggleButton
aria-label="left aligned"
data-testid="leftButton"
value="left"
>
<FormatAlignLeft />
</ToggleButton>
<ToggleButton
aria-label="centered"
data-testid="centerButton"
value="center"
>
<FormatAlignCenter />
</ToggleButton>
<ToggleButton
aria-label="right aligned"
data-testid="rightButton"
value="right"
>
<FormatAlignRight />
</ToggleButton>
<ToggleButton
aria-label="justified"
data-testid="justifyButton"
value="justify"
>
<FormatAlignJustify />
</ToggleButton>
</ToggleButtonGroup>
);
}