-
Notifications
You must be signed in to change notification settings - Fork 42
/
responsive.web.js
54 lines (47 loc) · 1.18 KB
/
responsive.web.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
import { View } from "react-native";
import styled from "styled-components";
import { breakpoints, spacing } from "@times-components/styleguide";
export const ChildContainer = styled(View)`
flex: 1;
padding-left: ${spacing(2)};
padding-right: ${spacing(2)};
@media (min-width: ${breakpoints.medium}px) {
flex-basis: 0 !important;
padding-left: 0;
padding-right: 0;
}
`;
export const getChildrenContainer = ({ childCount }) => {
let Base = styled(View)`
flex: 1;
flex-direction: column;
flex-wrap: wrap;
padding-bottom: ${spacing(2)};
padding-top: ${spacing(2)};
width: 100%;
@media (min-width: ${breakpoints.medium}px) {
flex-direction: row;
}
`;
if (childCount >= 3) {
Base = styled(Base)`
@media (min-width: ${breakpoints.medium}px) {
padding-left: ${spacing(4)};
padding-right: ${spacing(4)};
width: 100%;
}
`;
} else {
Base = styled(Base)`
@media (min-width: ${breakpoints.medium}px) {
width: 80.8%;
}
`;
}
Base = styled(Base)`
@media (min-width: ${breakpoints.wide}px) {
width: ${childCount >= 3 ? "100%" : "56.2%"};
}
`;
return Base;
};