File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
packages/gatsby-theme/src/components/shared Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ import styled , { css } from '../style/styled' ;
2
+ import { mobile } from '../style/media' ;
3
+ import { SpaceSizes } from '../style/theme' ;
4
+
5
+ type Props = {
6
+ width ?: SpaceSizes ;
7
+ height ?: SpaceSizes ;
8
+ widthOnMobile ?: SpaceSizes ;
9
+ heightOnMobile ?: SpaceSizes ;
10
+ fillRow ?: boolean ;
11
+ fillColumn ?: boolean ;
12
+ } ;
13
+
14
+ export const Space = styled . div < Props > `
15
+ width: ${ p => ( typeof p . width === 'number' ? p . width + 'px' : 'auto' ) } ;
16
+ height: ${ p => ( typeof p . height === 'number' ? p . height + 'px' : 'auto' ) } ;
17
+ flex-shrink: 0;
18
+
19
+ ${ p =>
20
+ mobile ( css `
21
+ ${ typeof p . widthOnMobile === 'number' &&
22
+ css `
23
+ width : ${ p . widthOnMobile } px;
24
+ ` } ;
25
+
26
+ ${ typeof p . heightOnMobile === 'number' &&
27
+ css `
28
+ height: ${ p . heightOnMobile } px;
29
+ ` } ;
30
+ ` ) } ;
31
+
32
+ ${ p =>
33
+ p . fillRow &&
34
+ css `
35
+ flex- grow: 1;
36
+ margin- right: auto ;
37
+ margin- left: auto ;
38
+ ` } ;
39
+
40
+ ${ p =>
41
+ p . fillColumn &&
42
+ css `
43
+ flex- grow: 1;
44
+ margin- to p: auto ;
45
+ margin- botto m: auto ;
46
+ ` } ;
47
+ ` ;
You can’t perform that action at this time.
0 commit comments