Skip to content

Commit 029146a

Browse files
committed
Use 3d book on homepage
1 parent 496e684 commit 029146a

7 files changed

Lines changed: 108 additions & 52 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"card": "npx repng src/components/twitter-card.js -d static -f card.png -w 1024 -h 512"
1414
},
1515
"dependencies": {
16-
"@swizec/gatsby-theme-course-platform": "^1.4.0-8",
16+
"@swizec/gatsby-theme-course-platform": "^1.4.0-15",
1717
"gatsby": "^2.29.2",
1818
"react": "^16.12.0",
1919
"react-dom": "^16.12.0",

src/components/NavgGrid.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/components/home-title.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from "react"
22
import { Box, Flex, Heading, Text } from "theme-ui"
3-
import { GumroadButton } from "@swizec/gatsby-theme-course-platform"
4-
import * as coverImg from "../images/cover.svg"
53

64
const HomeTitle = () => (
75
<Flex sx={{ flexWrap: "wrap" }}>
@@ -19,8 +17,7 @@ const HomeTitle = () => (
1917
<Text sx={{ fontSize: 4 }}>for frontend engineers</Text>
2018
</Heading>
2119
<Text>
22-
Learn everything you need to dive into modern backend. Understand{" "}
23-
<em>any</em> backend
20+
Dive into modern backend. Understand <em>any</em> backend
2421
</Text>
2522

2623
<Box sx={{ mt: 10 }}>

src/components/homepage.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import React from "react"
2+
import { useAuth } from "react-use-auth"
3+
import { Heading, Flex, Box, Text } from "theme-ui"
4+
import { GumroadButton, FormCK } from "@swizec/gatsby-theme-course-platform"
5+
// import * as coverImg from "../images/cover.svg"
6+
import * as coverImg from "../images/cover.png"
7+
8+
export const ChapterHeading = ({ sx }) => {
9+
const { isAuthenticated } = useAuth()
10+
11+
if (isAuthenticated()) {
12+
return <Heading sx={sx}>Chapters</Heading>
13+
} else {
14+
return <Heading sx={sx}>Preview Chapters</Heading>
15+
}
16+
}
17+
18+
export const NavGrid = (props) => (
19+
<Box
20+
{...props}
21+
sx={{
22+
fontFamily: "heading",
23+
ul: {
24+
listStyle: "none",
25+
p: 0,
26+
display: "grid",
27+
gridGap: 3,
28+
gridTemplateRows: [`repeat(9, 1fr)`, `repeat(5, 1fr)`],
29+
gridTemplateColumns: ["repeat(2, 1fr)", "repeat(3, 1fr)"],
30+
gridAutoFlow: ["dense", "column"],
31+
counterReset: "nav-grid",
32+
},
33+
li: {
34+
fontWeight: "bold",
35+
fontSize: [1, 2, 2],
36+
counterIncrement: "nav-grid",
37+
mb: 0,
38+
"::before": {
39+
content: "counter(nav-grid)",
40+
display: "inline-block",
41+
pr: 1,
42+
},
43+
},
44+
a: {
45+
color: "inherit",
46+
textDecoration: "none",
47+
transition: "color .2s ease-out",
48+
":hover,:focus": {
49+
color: "primary",
50+
},
51+
},
52+
}}
53+
/>
54+
)
55+
56+
export const HomeTitle = () => (
57+
<Flex sx={{ flexWrap: "wrap" }}>
58+
<Box
59+
sx={{
60+
p: 3,
61+
minWidth: 250,
62+
flex: 1,
63+
textAlign: "center",
64+
margin: "auto auto",
65+
}}
66+
>
67+
<Heading sx={{ fontSize: 6 }}>
68+
Serverless Handbook
69+
<Text sx={{ fontSize: 4 }}>for frontend engineers</Text>
70+
</Heading>
71+
<Text>
72+
Dive into modern backend. Understand <em>any</em> backend
73+
</Text>
74+
75+
{/* <FormCK copyBefore="" submitText="Get my free chapter 💌">
76+
Hai
77+
</FormCK> */}
78+
79+
<Box sx={{ mt: 10 }}>
80+
<GumroadButton>
81+
<a
82+
className="gumroad-button"
83+
href="https://gum.co/NsUlA"
84+
data-gumroad-single-product="true"
85+
target="_blank"
86+
rel="noopener noreferrer"
87+
>{`Get Serverless Handbook`}</a>
88+
</GumroadButton>
89+
</Box>
90+
</Box>
91+
92+
<Box sx={{ p: 3, minWidth: 250, flex: 1, textAlign: "center" }}>
93+
<img
94+
src={coverImg}
95+
alt="Serverless Handbook Cover"
96+
style={{ margin: "auto auto", maxWidth: "650px", width: "100%" }}
97+
/>
98+
</Box>
99+
</Flex>
100+
)

src/images/cover.png

1.04 MB
Loading

src/pages/index.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {
77
GumroadButton,
88
GumroadOverlay,
99
} from "@swizec/gatsby-theme-course-platform"
10-
import HomeTitle from "../components/home-title"
11-
import { NavGrid } from "../components/NavgGrid"
10+
import { NavGrid, ChapterHeading, HomeTitle } from "../components/homepage"
1211

1312
export const pageQuery = graphql`
1413
query {
@@ -49,7 +48,7 @@ export const pageQuery = graphql`
4948

5049
<Box sx={{ my: "auto" }} />
5150

52-
<Heading sx={{ mb: 1 }}>Chapters</Heading>
51+
<ChapterHeading sx={{mb: 2}} />
5352

5453
<NavGrid>
5554

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,10 +2205,10 @@
22052205
"@styled-system/core" "^5.1.2"
22062206
"@styled-system/css" "^5.1.5"
22072207

2208-
"@swizec/gatsby-theme-course-platform@^1.4.0-8":
2209-
version "1.4.0-8"
2210-
resolved "https://registry.yarnpkg.com/@swizec/gatsby-theme-course-platform/-/gatsby-theme-course-platform-1.4.0-8.tgz#fcddeec0fb968152eef8f32b5678c246bf65d654"
2211-
integrity sha512-t5Ym5JHdH53ooe5OOa5Xg3nzzlO/00jGGIP4rB2a9hcQzHSugQZRAnRUAY9TbV8ilXS29tffbBMxRwpsdMI9Yg==
2208+
"@swizec/gatsby-theme-course-platform@^1.4.0-15":
2209+
version "1.4.0-15"
2210+
resolved "https://registry.yarnpkg.com/@swizec/gatsby-theme-course-platform/-/gatsby-theme-course-platform-1.4.0-15.tgz#4bce1485d9a76dfe2dba685d9be8a0551d4273ac"
2211+
integrity sha512-rGcRaoVn6Coh856WzsCUySCoVdw3thrpy14ZIj2nvBLjJzhAXrzvoWJgf4xQQXObTlDcLvFhF3aAgRty9RuZVQ==
22122212
dependencies:
22132213
"@jxnblk/react-live" "2.1.2-1"
22142214
"@mdx-js/mdx" "^1.6.22"

0 commit comments

Comments
 (0)