-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Subheader.js
61 lines (52 loc) · 1.07 KB
/
Subheader.js
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
import React from 'react';
import PropTypes from 'prop-types';
const Subheader = (props, context) => {
const {
children,
inset,
style,
...other
} = props;
const {
prepareStyles,
subheader,
} = context.muiTheme;
const styles = {
root: {
boxSizing: 'border-box',
color: subheader.color,
fontSize: 14,
fontWeight: subheader.fontWeight,
lineHeight: '48px',
paddingLeft: inset ? 72 : 16,
width: '100%',
},
};
return (
<div {...other} style={prepareStyles(Object.assign(styles.root, style))}>
{children}
</div>
);
};
Subheader.muiName = 'Subheader';
Subheader.propTypes = {
/**
* Node that will be placed inside the `Subheader`.
*/
children: PropTypes.node,
/**
* If true, the `Subheader` will be indented.
*/
inset: PropTypes.bool,
/**
* Override the inline-styles of the root element.
*/
style: PropTypes.object,
};
Subheader.defaultProps = {
inset: false,
};
Subheader.contextTypes = {
muiTheme: PropTypes.object.isRequired,
};
export default Subheader;