We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a355648 commit ade58ebCopy full SHA for ade58eb
docs/src/pages/customization/breakpoints/WithWidth.tsx
@@ -0,0 +1,25 @@
1
+import React from 'react';
2
+import withWidth from '@material-ui/core/withWidth';
3
+import Typography from '@material-ui/core/Typography';
4
+import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';
5
+
6
+type TagName = 'em' | 'u' | 'del';
7
8
+const components: Partial<Record<Breakpoint, TagName>> = {
9
+ sm: 'em',
10
+ md: 'u',
11
+ lg: 'del',
12
+};
13
14
+function WithWidth(props: { width: Breakpoint }) {
15
+ const { width } = props;
16
+ const Component = components[width] || 'span';
17
18
+ return (
19
+ <Typography variant="subtitle1">
20
+ <Component>{`Current width: ${width}`}</Component>
21
+ </Typography>
22
+ );
23
+}
24
25
+export default withWidth()(WithWidth);
0 commit comments