blob: 2aab0e3a7d721dfad2be14833bc0a470369130d0 (
plain)
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
|
import React from 'react';
import PropTypes from 'prop-types';
import { withWidth, Typography } from '@material-ui/core';
const components = {
sm: 'em',
md: 'u',
lg: 'del',
};
function WithWidth(props) {
const { width } = props;
const Component = components[width] || 'span';
return (
<Typography variant="subtitle1">
<Component>{`Current width: ${width}`}</Component>
</Typography>
);
}
WithWidth.propTypes = {
width: PropTypes.string.isRequired,
};
export default withWidth()(WithWidth);
|