-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.tsx
221 lines (201 loc) · 5.39 KB
/
page.tsx
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import Image from "next/image";
import styles from "./page.module.css";
import { sx } from "@/components/styled";
import { Container, Header } from "@/components/Header/Header";
import { cookies } from "next/headers";
import { Counter } from "@/components/Counter";
import { styled } from "@linaria/react";
const fs = 22;
const Main = styled.main({
// @ts-ignore
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
alignItems: "center",
minHeight: "100vh",
});
// @ts-ignore
const Description = styled.div(({ theme }: any) => ({
display: "inherit",
justifyContent: "inherit",
alignItems: "inherit",
// fontSize: "0.9rem",
fontSize: fs,
maxWidth: 1200,
width: "100%",
zIndex: "2",
fontFamily: theme.typography.fontFamily,
"& a": {
display: "flex",
justifyContent: "center",
alignItems: "center",
gap: "0.5rem",
},
"& p": {
position: "relative",
margin: "0",
padding: "1rem",
backgroundColor: "primary.300",
border: `1px solid rgba(${theme.vars.palette.success[400]}, 0.3)`,
borderRadius: theme.shape.borderRadius / 20,
},
}));
// @ts-ignore
const Code = styled.code(({ theme }: any) => ({
fontWeight: "700",
fontFamily: theme.typography.fontFamilyCode,
}));
const Grid = styled.div`
display: grid;
grid-template-columns: repeat(4, minmax(25%, auto));
width: var(--max-width);
max-width: 100%;
@media (max-width: 700px) {
grid-template-columns: 1fr;
margin-bottom: 120px;
max-width: 320px;
text-align: center;
}
@media (min-width: 701px) and (max-width: 1120px) {
grid-template-columns: repeat(2, 50%);
}
`;
const Card = styled.a({
// @ts-ignore
padding: "1rem 1.2rem",
borderRadius: "var(--border-radius)",
background: "rgba(var(--card-rgb), 0)",
border: "1px solid rgba(var(--card-border-rgb), 0)",
transition: "background 200ms, border 200ms",
"& span": {
display: "inline-block",
transition: "transform 200ms",
},
"& h2": {
fontWeight: 600,
marginBottom: "0.7rem",
},
"& p": {
margin: 0,
opacity: "0.6",
fontSize: "0.9rem",
lineHeight: "1.5",
maxWidth: "30ch",
},
"@media (hover: hover) and (pointer: fine)": {
"&:hover": {
background: "rgba(var(--card-rgb), 0.1)",
border: "1px solid rgba(var(--card-border-rgb), 0.15)",
},
"&:hover span": {
transform: "translateX(4px)",
},
},
"@media (prefers-reduced-motion)": {
"&:hover span": {
transform: "none",
},
},
"@media (max-width: 700px)": {
padding: "1rem 2.5rem",
"& h2": {
marginBottom: "0.5rem",
},
},
});
export default function Home() {
const currentMode = cookies().get("mode");
async function updateMode() {
"use server";
if (currentMode?.value === "dark") {
cookies().delete("mode");
} else {
cookies().set("mode", "dark");
}
}
return (
<Main>
<Header>
<Container>
Header
<form action={updateMode}>
<button type="submit">
{currentMode?.value === "dark" ? "dark" : "light"}
</button>
</form>
</Container>
</Header>
<Description>
<Container>
<p>
Get started by editing
<Code>src/app/page.tsx</Code>
</p>
<div>
<Counter />
</div>
</Container>
</Description>
<div className={styles.center}>
<Image
className={sx(({ theme, darkTheme }: any) => ({
position: "relative",
backgroundColor: theme.palette.primary.main,
"@media (prefers-color-scheme: dark)": {
filter: "invert(1) drop-shadow(0 0 0.3rem #ffffff70)",
},
}))}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>
<Grid>
<Card
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<h2>
Docs <span>-></span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
</Card>
<Card
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<h2>
Learn <span>-></span>
</h2>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</Card>
<Card
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<h2>
Templates <span>-></span>
</h2>
<p>Explore the Next.js 13 playground.</p>
</Card>
<Card
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-></span>
</h2>
<p>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</Card>
</Grid>
</Main>
);
}