Skip to content

Commit b79a6d0

Browse files
committed
add responsive styled components to utils
1 parent fb03f31 commit b79a6d0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { styled, css } from '../styles';
2+
3+
const mobile = body => css`
4+
@media (max-width: ${props => props.theme.breakpoints[0]}) {
5+
${body};
6+
}
7+
`;
8+
9+
const tablet = body => css`
10+
@media (max-width: ${props => props.theme.breakpoints[1]}) {
11+
${body};
12+
}
13+
`;
14+
15+
export const ShowOnMobile = styled.div`
16+
display: none;
17+
${mobile(css`
18+
display: block;
19+
`)};
20+
`;
21+
22+
export const HideOnMobile = styled.div`
23+
${mobile(css`
24+
display: none;
25+
`)};
26+
`;
27+
28+
export const ShowOnTablet = styled.div`
29+
display: none;
30+
${tablet(css`
31+
display: block;
32+
`)};
33+
`;
34+
35+
export const HideOnTablet = styled.div`
36+
${tablet(css`
37+
display: none;
38+
`)};
39+
`;

0 commit comments

Comments
 (0)