-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypography.tsx
More file actions
45 lines (40 loc) · 979 Bytes
/
Typography.tsx
File metadata and controls
45 lines (40 loc) · 979 Bytes
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
import MuiTypography from "@mui/material/Typography";
import { type TypographyVariant } from "@mui/material";
import type { ComponentState, ComponentProps } from "@/index";
import { Children } from "@/index";
interface TypographyState extends ComponentState {
align?: "right" | "left" | "center" | "inherit" | "justify";
gutterBottom?: boolean;
noWrap?: boolean;
variant?: TypographyVariant;
text?: string;
color?: string;
}
interface TypographyProps extends ComponentProps, TypographyState {}
export const Typography = ({
id,
style,
align,
gutterBottom,
noWrap,
variant,
text,
color,
children: nodes,
onChange,
}: TypographyProps) => {
nodes = text ? [text] : nodes;
return (
<MuiTypography
id={id}
style={style}
align={align}
gutterBottom={gutterBottom}
noWrap={noWrap}
variant={variant}
color={color}
>
<Children nodes={nodes} onChange={onChange} />
</MuiTypography>
);
};