File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
packages/gatsby-theme/src/utils Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
+ ` ;
You can’t perform that action at this time.
0 commit comments