-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
162 lines (146 loc) · 3.74 KB
/
index.tsx
File metadata and controls
162 lines (146 loc) · 3.74 KB
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
import { NextPage, GetServerSideProps } from 'next'
import Head from 'next/head'
import { format } from 'date-fns'
import { styled, globalCss, theme } from '../../stitches.config'
import globalStyle from '../../components/global-style'
import Box from '../../components/box'
import Text from '../../components/text'
import Heading from '../../components/heading'
const customGlobalStyle = globalCss({
':root': {
[theme.space.documentBorderWidth.variable]: 0,
},
})
interface Props {
title: string
date?: string
}
const Page: NextPage<Props> = ({ title, date }) => {
globalStyle()
customGlobalStyle()
return (
<DocumentOuter>
<Head>
<meta name='robots' content='noindex' />
<style
type='text/css'
dangerouslySetInnerHTML={{
__html: `
@font-face {
font-family: 'PT Root UI';
font-display: swap;
src: url('/fonts/pt-root-ui-vf/fonts/pt-root-ui-vf.woff2') format('woff2');
}
@font-face {
font-family: 'Zangezi Sans';
font-weight: 700;
font-display: swap;
src: url('/fonts/zangezi-sans-0.9/ZangeziSans09-Black.woff2') format('woff2');
}
@font-face {
font-family: 'JetBrains Mono';
font-display: swap;
src: url('/fonts/JetBrainsMono-1.0.3/web/woff2/JetBrainsMono-Regular.woff2') format('woff2');
}
`,
}}
/>
</Head>
<Container>
<Box
css={{
padding: '$2',
paddingBlockEnd: 0,
}}
>
<LogoContainer>
<LogoImage
src='http://gravatar.com/avatar/baa7a8ec68ea6c13a1f0691098872575?s=200'
alt='Photo of me'
width={34}
height={34}
/>
<Text as='h2' weight='bold' size='milli'>
Ash
</Text>
</LogoContainer>
</Box>
<Box
css={{
paddingInline: '$2',
}}
>
<Heading
as='h1'
dangerouslySetInnerHTML={{
__html: title,
}}
/>
{date && (
<Text variant='mono' size='micro' as='time' dateTime={date}>
{format(new Date(date), 'd MMMM yyyy')}
</Text>
)}
</Box>
<Footer>
<Box
css={{
paddingInline: '$2',
paddingBlock: '$1',
}}
>
<Text size='micro'>@juice49</Text>
</Box>
<Box
css={{
paddingInline: '$2',
paddingBlock: '$1',
}}
>
<Text size='micro'>https://ash.gd</Text>
</Box>
</Footer>
</Container>
</DocumentOuter>
)
}
export default Page
export const getServerSideProps: GetServerSideProps = async ({ query }) => {
const props: Props = {
title: [].concat(query.title)[0],
}
if (query.date) {
props.date = [].concat(query.date)[0]
}
return { props }
}
export const config = {
unstable_runtimeJS: false,
}
const DocumentOuter = styled('div', {
display: 'flex',
minHeight: '100vh',
backgroundColor: '$background',
})
const Container = styled('div', {
display: 'grid',
width: '100%',
zoom: 1.75,
gridTemplateRows: 'auto 1fr auto',
alignItems: 'center',
})
const Footer = styled('footer', {
display: 'flex',
justifyContent: 'space-between',
backgroundColor: '#fff',
color: '$bodySubtle',
})
const LogoContainer = styled('div', {
display: 'flex',
gap: '$1',
alignItems: 'center',
})
const LogoImage = styled('img', {
display: 'block',
borderRadius: '50%',
})