1
1
import React from "react"
2
+ import {
3
+ Badge ,
4
+ Box ,
5
+ Flex ,
6
+ Text ,
7
+ Divider as ChakraDivider ,
8
+ Heading ,
9
+ Icon ,
10
+ chakra ,
11
+ } from "@chakra-ui/react"
2
12
import { graphql , PageProps } from "gatsby"
3
13
import { useI18next } from "gatsby-plugin-react-i18next"
4
14
import { MDXProvider } from "@mdx-js/react"
5
15
import { MDXRenderer } from "gatsby-plugin-mdx"
6
- import styled from "@emotion/styled"
7
- import { Badge } from "@chakra-ui/react"
8
16
9
17
import ButtonLink from "../components/ButtonLink"
10
18
import Breadcrumbs from "../components/Breadcrumbs"
@@ -20,101 +28,141 @@ import MeetupList from "../components/MeetupList"
20
28
import PageMetadata from "../components/PageMetadata"
21
29
import RandomAppList from "../components/RandomAppList"
22
30
import ExpandableCard from "../components/ExpandableCard"
23
- import TableOfContents , {
24
- Item as ItemTableOfContents ,
25
- } from "../components/TableOfContents"
31
+ import TableOfContents from "../components/TableOfContents"
26
32
import Translation from "../components/Translation"
27
33
import SectionNav from "../components/SectionNav"
28
34
import DocLink from "../components/DocLink"
29
35
import GhostCard from "../components/GhostCard"
30
36
import MatomoOptOut from "../components/MatomoOptOut"
31
37
import UpgradeStatus from "../components/UpgradeStatus"
32
- import {
33
- Divider ,
34
- Paragraph ,
35
- Header1 ,
36
- Header2 ,
37
- Header3 ,
38
- Header4 ,
39
- ListItem ,
40
- CardContainer ,
41
- } from "../components/SharedStyledComponents"
42
- import Emoji from "../components/OldEmoji"
38
+ import Emoji from "../components/Emoji"
43
39
import UpcomingEventsList from "../components/UpcomingEventsList"
44
- import Icon from "../components/Icon"
45
40
import SocialListItem from "../components/SocialListItem"
46
41
import YouTube from "../components/YouTube"
47
42
import TranslationChartImage from "../components/TranslationChartImage"
48
43
import PostMergeBanner from "../components/Banners/PostMergeBanner"
49
44
import EnergyConsumptionChart from "../components/EnergyConsumptionChart"
50
45
import QuizWidget from "../components/Quiz/QuizWidget"
46
+ import { Item as ItemTableOfContents } from "../components/TableOfContents/utils"
51
47
52
48
import { getLocaleTimestamp } from "../utils/time"
53
49
import { isLangRightToLeft , TranslationKey } from "../utils/translations"
54
50
import { Lang } from "../utils/languages"
55
- import { Context } from "../types"
56
51
57
- const Container = styled . div `
58
- width: 100%;
59
- `
52
+ import { ChildOnlyProp , Context } from "../types"
60
53
61
- const Page = styled . div `
62
- display: flex;
63
- justify-content: space-between;
64
- width: 100%;
65
- margin: 0 auto 4rem;
66
- padding: 2rem;
54
+ const Pre = ( props : ChildOnlyProp ) => (
55
+ < Text
56
+ as = "pre"
57
+ maxW = "full"
58
+ overflowX = "scroll"
59
+ bgColor = "preBackground"
60
+ borderRadius = "base"
61
+ p = { 4 }
62
+ border = "1px solid"
63
+ borderColor = "preBorder"
64
+ whiteSpace = "pre-wrap"
65
+ { ...props }
66
+ />
67
+ )
67
68
68
- @media (min-width: ${ ( props ) => props . theme . breakpoints . l } ) {
69
- padding-top: 4rem;
70
- }
71
- `
69
+ const HR = ( ) => (
70
+ < ChakraDivider
71
+ mt = { 8 }
72
+ mb = { 4 }
73
+ display = "inline-block"
74
+ position = "inherit"
75
+ bg = "border"
76
+ />
77
+ )
72
78
73
- // Apply styles for classes within markdown here
74
- const ContentContainer = styled . article `
75
- max-width: ${ ( props ) => props . theme . breakpoints . m } ;
76
- width: 100%;
79
+ const Divider = ( ) => < Box my = { 16 } w = "10%" h = { 1 } bgColor = "homeDivider" />
77
80
78
- .featured {
79
- padding-left: 1rem;
80
- margin-left: -1rem;
81
- border-left: 1px dotted ${ ( props ) => props . theme . colors . primary } ;
82
- }
81
+ const Header1 = ( props : ChildOnlyProp ) => (
82
+ < Heading
83
+ as = "h1"
84
+ fontSize = { { base : "2.5rem" , md : "5xl" } }
85
+ lineHeight = { 1.4 }
86
+ fontWeight = "bold"
87
+ _before = { {
88
+ content : `""` ,
89
+ display : "block" ,
90
+ h : "140px" ,
91
+ mt : "-140px" ,
92
+ visibility : "hidden" ,
93
+ } }
94
+ sx = { {
95
+ a : {
96
+ display : "none" ,
97
+ } ,
98
+ } }
99
+ { ...props }
100
+ />
101
+ )
83
102
84
- .citation {
85
- p {
86
- color: ${ ( props ) => props . theme . colors . text200 } ;
87
- }
88
- }
89
- `
103
+ const Header2 = ( props : ChildOnlyProp ) => (
104
+ < Heading
105
+ fontSize = { { base : "2xl" , md : "2rem" } }
106
+ lineHeight = { 1.4 }
107
+ fontWeight = "bold"
108
+ sx = { { position : "inherit !important" } }
109
+ _before = { {
110
+ content : `""` ,
111
+ display : "block" ,
112
+ h : "120px" ,
113
+ mt : "-120px" ,
114
+ visibility : "hidden" ,
115
+ } }
116
+ { ...props }
117
+ />
118
+ )
90
119
91
- const LastUpdated = styled . p `
92
- color: ${ ( props ) => props . theme . colors . text200 } ;
93
- `
120
+ const Header3 = ( props : ChildOnlyProp ) => (
121
+ < Heading
122
+ as = "h3"
123
+ fontSize = { { base : "xl" , md : "2xl" } }
124
+ lineHeight = { 1.4 }
125
+ sx = { { position : "inherit !important" } }
126
+ _before = { {
127
+ content : `""` ,
128
+ display : "block" ,
129
+ h : "120px" ,
130
+ mt : "-120px" ,
131
+ visibility : "hidden" ,
132
+ } }
133
+ { ...props }
134
+ />
135
+ )
94
136
95
- const Pre = styled . pre `
96
- max-width: 100%;
97
- overflow-x: scroll;
98
- background-color: ${ ( props ) => props . theme . colors . preBackground } ;
99
- border-radius: 0.25rem;
100
- padding: 1rem;
101
- border: 1px solid ${ ( props ) => props . theme . colors . preBorder } ;
102
- white-space: pre-wrap;
103
- `
137
+ const Header4 = ( props : ChildOnlyProp ) => (
138
+ < Heading
139
+ as = "h4"
140
+ fontSize = { { base : "md" , md : "xl" } }
141
+ lineHeight = { 1.4 }
142
+ fontWeight = "semibold"
143
+ sx = { { position : "unset !important" } }
144
+ _before = { {
145
+ content : `""` ,
146
+ display : "block" ,
147
+ h : "120px" ,
148
+ mt : "-120px" ,
149
+ visibility : "hidden" ,
150
+ } }
151
+ { ...props }
152
+ />
153
+ )
104
154
105
- const MobileTableOfContents = styled ( TableOfContents ) `
106
- position: relative;
107
- z-index: 2;
108
- `
155
+ const Paragraph = ( props : ChildOnlyProp ) => (
156
+ < Text fontSize = "md" mt = { 8 } mb = { 4 } color = "text300" { ...props } />
157
+ )
109
158
110
- const HR = styled . hr `
111
- width: 100%;
112
- margin: 2rem 0rem;
113
- margin-bottom: 1rem;
114
- display: inline-block;
115
- position: inherit;
116
- background: ${ ( props ) => props . theme . colors . border } ;
117
- `
159
+ const ListItem = ( props : ChildOnlyProp ) => (
160
+ < chakra . li color = "text300" { ...props } />
161
+ )
162
+
163
+ const CardContainer = ( props : ChildOnlyProp ) => (
164
+ < Flex wrap = "wrap" mx = { - 4 } { ...props } />
165
+ )
118
166
119
167
// Note: you must pass components to MDXProvider in order to render them in markdown files
120
168
// https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#mdxprovider
@@ -190,26 +238,55 @@ const StaticPage = ({
190
238
const absoluteEditPath = `${ editContentUrl } ${ relativePath } `
191
239
192
240
return (
193
- < Container >
241
+ < Box w = "full" >
194
242
{ showPostMergeBanner && (
195
243
< PostMergeBanner
196
244
translationString = { postMergeBannerTranslationString ! }
197
245
/>
198
246
) }
199
- < Page dir = { isRightToLeft ? "rtl" : "ltr" } >
247
+ < Flex
248
+ justifyContent = "space-between"
249
+ w = "full"
250
+ mx = "auto"
251
+ mb = { 16 }
252
+ p = { 8 }
253
+ pt = { { base : 8 , lg : 16 } }
254
+ dir = { isRightToLeft ? "rtl" : "ltr" }
255
+ >
200
256
< PageMetadata
201
257
title = { mdx . frontmatter . title }
202
258
description = { mdx . frontmatter . description }
203
259
/>
204
- < ContentContainer >
260
+ < Box
261
+ as = "article"
262
+ maxW = "container.md"
263
+ w = "full"
264
+ sx = { {
265
+ ".featured" : {
266
+ pl : 4 ,
267
+ ml : - 4 ,
268
+ borderLeft : "1px dotted" ,
269
+ borderLeftColor : "primary" ,
270
+ } ,
271
+
272
+ ".citation" : {
273
+ p : {
274
+ color : "text200" ,
275
+ } ,
276
+ } ,
277
+ } }
278
+ >
205
279
< Breadcrumbs slug = { slug } />
206
- < LastUpdated
280
+ < Text
281
+ color = "text200"
207
282
dir = { isLangRightToLeft ( language as Lang ) ? "rtl" : "ltr" }
208
283
>
209
284
< Translation id = "page-last-updated" /> :{ " " }
210
285
{ getLocaleTimestamp ( language as Lang , lastUpdatedDate ) }
211
- </ LastUpdated >
212
- < MobileTableOfContents
286
+ </ Text >
287
+ < TableOfContents
288
+ position = "relative"
289
+ zIndex = { 2 }
213
290
editPath = { absoluteEditPath }
214
291
items = { tocItems }
215
292
isMobile = { true }
@@ -220,7 +297,7 @@ const StaticPage = ({
220
297
< MDXRenderer > { mdx . body } </ MDXRenderer >
221
298
</ MDXProvider >
222
299
< FeedbackCard isArticle />
223
- </ ContentContainer >
300
+ </ Box >
224
301
{ tocItems && (
225
302
< TableOfContents
226
303
editPath = { absoluteEditPath }
@@ -229,8 +306,8 @@ const StaticPage = ({
229
306
hideEditButton = { ! ! mdx . frontmatter . hideEditButton }
230
307
/>
231
308
) }
232
- </ Page >
233
- </ Container >
309
+ </ Flex >
310
+ </ Box >
234
311
)
235
312
}
236
313
0 commit comments