-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathindex.js
More file actions
100 lines (87 loc) · 2.32 KB
/
index.js
File metadata and controls
100 lines (87 loc) · 2.32 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
=========================================================
* Material Dashboard 2 React - v2.1.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2022 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
import { forwardRef } from "react";
// prop-types is a library for typechecking of props
import PropTypes from "prop-types";
// Custom styles for MDTypography
import MDTypographyRoot from "components/MDTypography/MDTypographyRoot";
// Material Dashboard 2 React contexts
import { useMaterialUIController } from "context";
const MDTypography = forwardRef(
(
{ color, fontWeight, textTransform, verticalAlign, textGradient, opacity, children, ...rest },
ref
) => {
const [controller] = useMaterialUIController();
const { darkMode } = controller;
return (
<MDTypographyRoot
{...rest}
ref={ref}
ownerState={{
color,
textTransform,
verticalAlign,
fontWeight,
opacity,
textGradient,
darkMode,
}}
>
{children}
</MDTypographyRoot>
);
}
);
// Setting default values for the props of MDTypography
MDTypography.defaultProps = {
color: "dark",
fontWeight: false,
textTransform: "none",
verticalAlign: "unset",
textGradient: false,
opacity: 1,
};
// Typechecking props for the MDTypography
MDTypography.propTypes = {
color: PropTypes.oneOf([
"inherit",
"primary",
"secondary",
"info",
"success",
"warning",
"error",
"light",
"dark",
"text",
"white",
"lime",
"blue",
]),
fontWeight: PropTypes.oneOf([false, "light", "regular", "medium", "bold"]),
textTransform: PropTypes.oneOf(["none", "capitalize", "uppercase", "lowercase"]),
verticalAlign: PropTypes.oneOf([
"unset",
"baseline",
"sub",
"super",
"text-top",
"text-bottom",
"middle",
"top",
"bottom",
]),
textGradient: PropTypes.bool,
children: PropTypes.node.isRequired,
opacity: PropTypes.number,
};
export default MDTypography;