|
| 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 | +) |
0 commit comments