forked from wso2/carbon-apimgt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InlineMessage.jsx
63 lines (59 loc) · 1.88 KB
/
InlineMessage.jsx
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
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import InfoOutlined from '@material-ui/icons/InfoOutlined';
import VerticalDivider from './VerticalDivider';
const styles = theme => ({
root: {
display: 'flex',
alignItems: 'center',
paddingLeft: theme.spacing.unit * 2,
borderRadius: theme.shape.borderRadius,
border: 'solid 1px ' + theme.palette.secondary.main,
},
iconItem: {
paddingRight: theme.spacing.unit * 2,
fontSize: 40,
},
button: {
marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
},
content: {
paddingTop: theme.spacing.unit,
paddingBottom: theme.spacing.unit,
paddingRight: theme.spacing.unit,
},
});
class InlineMessage extends React.Component {
handleExpandClick = () => {
this.setState(state => ({ expanded: !state.expanded }));
};
render() {
const { classes, height, type } = this.props;
return (
<Paper className={classes.root} elevation={1} {...this.props}>
{type === 'info' && <InfoOutlined className={classes.iconItem} />}
{type === 'warn' && <InfoOutlined className={classes.iconItem} />}
<VerticalDivider height={height} />
<div className={classes.content}>{this.props.children}</div>
</Paper>
);
}
}
InlineMessage.propTypes = {
classes: PropTypes.shape({
root: PropTypes.string,
iconItem: PropTypes.string,
content: PropTypes.string,
}).isRequired,
height: PropTypes.number,
type: PropTypes.string,
children: PropTypes.shape({}).isRequired,
};
InlineMessage.defaultProps = {
height: 100,
type: 'info',
};
export default withStyles(styles)(InlineMessage);