-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathcontainer.js
74 lines (73 loc) · 2 KB
/
container.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
export default function Container({
center,
vCenter,
dark,
gray,
wide,
wideOnMobile,
small,
padding,
overflow,
minHeight,
dotBackground,
children,
mobileStyle,
divider,
...props
}) {
return (
<div {...props} className="container">
<style jsx>
{`
.container {
width: 100%;
margin: 0 auto;
padding: ${padding ? '6.25rem' : '0'} ${wide ? '0' : '1rem'};
${wide && !small ? '' : 'max-width: 1024px;'}
${small ? 'max-width: 682px;' : ''}
${center ? 'text-align: center;' : ''}
${dark ? 'background: #111;' : ''}
${dark ? 'color: #f1f1f1;' : ''}
${gray ? 'background-color: #fafafa;' : ''}
${gray ? 'border-top: 1px solid #eaeaea;' : ''}
${gray ? 'border-bottom: 1px solid #eaeaea;' : ''}
${wide && !overflow ? 'overflow: hidden;' : ''}
${minHeight ? `min-height: ${minHeight}px;` : ''}
${vCenter ? 'display: flex; align-items: center;' : ''}
${
dotBackground
? `
background-image: radial-gradient(#D7D7D7 1px, transparent 1px), radial-gradient(#d7d7d7 1px, transparent 1px);
background-position: 0 0, 25px 25px;
background-size: 50px 50px;
`
: ''
}
${divider ? `border-top: 1px solid rgba(0,0,0,0.1);` : ''}
}
.container:after {
// BFC
content: '';
display: table;
clear: both;
}
// CSS only media query for tablet
@media screen and (max-width: 960px) {
div {
padding: ${padding ? '4rem' : '0'} ${wide || wideOnMobile ? '0' : '2rem'};
${wideOnMobile && !overflow ? 'overflow: hidden;' : ''}
}
}
// CSS only media query for mobile
@media screen and (max-width: 640px) {
div {
padding: ${padding ? '4rem' : '0'} ${wide || wideOnMobile ? '0' : '1rem'};
${mobileStyle || ''}
}
}
`}
</style>
{children}
</div>
);
}