-
Notifications
You must be signed in to change notification settings - Fork 1
/
pageContent.css.ts
121 lines (117 loc) · 2.94 KB
/
pageContent.css.ts
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { style } from "@vanilla-extract/css";
import { recipe } from "@vanilla-extract/recipes";
import { vars } from "./theme.css";
import { responsiveStyle } from "./utils";
import { structuredTokens } from "hpe-design-tokens";
const responsiveContainerStyle = ({
small,
medium,
large,
xlarge,
}: {
small?: object;
medium?: object;
large?: object;
xlarge?: object;
}) => ({
"@container": {
[`(min-width: ${structuredTokens.content.small})`]: small || {},
[`(min-width: ${structuredTokens.content.medium})`]: medium || {},
[`(min-width: ${structuredTokens.content.large})`]: large || {},
[`(min-width: ${structuredTokens.content.xlarge})`]: xlarge || {},
},
});
const gridStyle = ({
mobile,
desktop,
tablet,
}: {
mobile?: object;
desktop: object;
tablet: object;
}) => [
{
display: "grid",
...mobile,
},
responsiveStyle({
desktop: desktop,
tablet: tablet,
}),
];
export const pageContent = recipe({
base: {
boxSizing: "border-box",
alignSelf: "center",
padding: vars.pageContent.padding.mobile,
...responsiveStyle({
tablet: {
padding: vars.pageContent.padding.tablet,
},
desktop: {
padding: vars.pageContent.padding.desktop,
},
}),
},
variants: {
kind: {
wide: {
maxWidth: vars.page.wide.maxWidth,
width: "100%",
},
narrow: {
maxWidth: vars.page.narrow.maxWidth,
},
full: {
width: "100%",
},
},
layout: {
"header-main": gridStyle({
mobile: {
gridTemplateAreas: `"pageHeader" "pageMain"`,
gridTemplateColumns: `1fr`,
gridTemplateRows: "auto auto",
gridGap: vars.spacing.medium.desktop,
},
tablet: {
gridTemplateAreas: `"pageHeader pageMain"`,
gridTemplateColumns: `${vars.content.medium} 1fr`,
},
desktop: {
gridTemplateAreas: `"pageHeader pageMain"`,
gridTemplateColumns: `${vars.content.medium} 1fr`,
},
}),
"header-main-aside": gridStyle({
mobile: {
gridTemplateAreas: `"pageHeader" "pageMain" "pageAside"`,
gridTemplateColumns: `1fr`,
gridTemplateRows: "auto auto auto",
gridGap: vars.spacing.medium.desktop,
},
desktop: {
gridTemplateAreas: `"pageHeader pageMain pageAside"`,
// TO DO use t-shirt size, this is midpoint of small/medium
gridTemplateColumns: `288px 1fr min(${vars.content.medium}, 100%)`,
},
tablet: {
gridTemplateAreas: `"pageHeader pageMain" "pageHeader pageAside"`,
gridTemplateColumns: `288px 1fr`,
gridTemplateRows: "auto auto",
width: "100%",
},
}),
},
},
});
export const actions = style({
...responsiveContainerStyle({
small: {
paddingTop: vars.spacing.medium.desktop,
},
large: {
paddingTop: "0px",
},
}),
});