|
1 | 1 | import * as React from "react";
|
2 |
| -import sections from "../data/cheatsheet/defaults.json"; |
3 |
| - |
4 |
| -// styles |
5 |
| -const pageStyles = { |
6 |
| - color: "#232129", |
7 |
| - padding: 96, |
8 |
| - fontFamily: "-apple-system, Roboto, sans-serif, serif", |
9 |
| -}; |
10 |
| -const headingStyles = { |
11 |
| - marginTop: 0, |
12 |
| - marginBottom: 64, |
13 |
| - maxWidth: 320, |
14 |
| -}; |
15 |
| -const headingAccentStyles = { |
16 |
| - color: "#663399", |
17 |
| -}; |
18 |
| -const paragraphStyles = { |
19 |
| - marginBottom: 48, |
20 |
| -}; |
21 |
| -const codeStyles = { |
22 |
| - color: "#8A6534", |
23 |
| - padding: 4, |
24 |
| - backgroundColor: "#FFF4DB", |
25 |
| - fontSize: "1.25rem", |
26 |
| - borderRadius: 4, |
27 |
| -}; |
28 |
| -const listStyles = { |
29 |
| - marginBottom: 96, |
30 |
| - paddingLeft: 0, |
31 |
| -}; |
32 |
| -const listItemStyles = { |
33 |
| - fontWeight: 300, |
34 |
| - fontSize: 24, |
35 |
| - maxWidth: 560, |
36 |
| - marginBottom: 30, |
37 |
| -}; |
38 |
| - |
39 |
| -const linkStyle = { |
40 |
| - color: "#8954A8", |
41 |
| - fontWeight: "bold", |
42 |
| - fontSize: 16, |
43 |
| - verticalAlign: "5%", |
44 |
| -}; |
45 |
| - |
46 |
| -const docLinkStyle = { |
47 |
| - ...linkStyle, |
48 |
| - listStyleType: "none", |
49 |
| - marginBottom: 24, |
50 |
| -}; |
51 |
| - |
52 |
| -const descriptionStyle = { |
53 |
| - color: "#232129", |
54 |
| - fontSize: 14, |
55 |
| - marginTop: 10, |
56 |
| - marginBottom: 0, |
57 |
| - lineHeight: 1.25, |
58 |
| -}; |
59 |
| - |
60 |
| -const docLink = { |
61 |
| - text: "TypeScript Documentation", |
62 |
| - url: "https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/", |
63 |
| - color: "#8954A8", |
64 |
| -}; |
65 |
| - |
66 |
| -const badgeStyle = { |
67 |
| - color: "#fff", |
68 |
| - backgroundColor: "#088413", |
69 |
| - border: "1px solid #088413", |
70 |
| - fontSize: 11, |
71 |
| - fontWeight: "bold", |
72 |
| - letterSpacing: 1, |
73 |
| - borderRadius: 4, |
74 |
| - padding: "4px 6px", |
75 |
| - display: "inline-block", |
76 |
| - position: "relative" as "relative", |
77 |
| - top: -2, |
78 |
| - marginLeft: 10, |
79 |
| - lineHeight: 1, |
80 |
| -}; |
81 |
| - |
82 |
| -// data |
83 |
| -const links = [ |
84 |
| - { |
85 |
| - text: "Tutorial", |
86 |
| - url: "https://www.gatsbyjs.com/docs/tutorial/", |
87 |
| - description: |
88 |
| - "A great place to get started if you're new to web development. Designed to guide you through setting up your first Gatsby site.", |
89 |
| - color: "#E95800", |
90 |
| - }, |
91 |
| - { |
92 |
| - text: "How to Guides", |
93 |
| - url: "https://www.gatsbyjs.com/docs/how-to/", |
94 |
| - description: |
95 |
| - "Practical step-by-step guides to help you achieve a specific goal. Most useful when you're trying to get something done.", |
96 |
| - color: "#1099A8", |
97 |
| - }, |
98 |
| - { |
99 |
| - text: "Reference Guides", |
100 |
| - url: "https://www.gatsbyjs.com/docs/reference/", |
101 |
| - description: |
102 |
| - "Nitty-gritty technical descriptions of how Gatsby works. Most useful when you need detailed information about Gatsby's APIs.", |
103 |
| - color: "#BC027F", |
104 |
| - }, |
105 |
| - { |
106 |
| - text: "Conceptual Guides", |
107 |
| - url: "https://www.gatsbyjs.com/docs/conceptual/", |
108 |
| - description: |
109 |
| - "Big-picture explanations of higher-level Gatsby concepts. Most useful for building understanding of a particular topic.", |
110 |
| - color: "#0D96F2", |
111 |
| - }, |
112 |
| - { |
113 |
| - text: "Plugin Library", |
114 |
| - url: "https://www.gatsbyjs.com/plugins", |
115 |
| - description: |
116 |
| - "Add functionality and customize your Gatsby site or app with thousands of plugins built by our amazing developer community.", |
117 |
| - color: "#8EB814", |
118 |
| - }, |
119 |
| - { |
120 |
| - text: "Build and Host", |
121 |
| - url: "https://www.gatsbyjs.com/cloud", |
122 |
| - badge: true, |
123 |
| - description: |
124 |
| - "Now you’re ready to show the world! Give your Gatsby site superpowers: Build and host on Gatsby Cloud. Get started for free!", |
125 |
| - color: "#663399", |
126 |
| - }, |
127 |
| -]; |
| 2 | +import cheatsheetInfo from "../data/cheatsheet/defaults.json"; |
| 3 | +import CheatsheetListComponent from "../components/CheatsheetListComponent"; |
| 4 | +import CheatsheetLegendComponent from "../components/CheatsheetLegendComponent"; |
| 5 | +import cheatsheetLegend from "../cheatsheetLegend"; |
| 6 | +import Helmet from "react-helmet"; |
| 7 | +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
| 8 | +import { faCircleQuestion } from "@fortawesome/free-solid-svg-icons"; |
| 9 | +import CheatsheetNotesComponent from "../components/CheatsheetNotesComponent"; |
| 10 | +import SmartLink from "../components/SmartLink"; |
128 | 11 |
|
129 | 12 | // markup
|
130 |
| -const IndexPage = () => { |
| 13 | +const CheatsheetPage = () => { |
131 | 14 | return (
|
132 |
| - <main style={pageStyles}> |
133 |
| - <title>Home Page</title> |
134 |
| - <h1 style={headingStyles}> |
135 |
| - Congratulations |
136 |
| - <br /> |
137 |
| - <span style={headingAccentStyles}>— you just made a Gatsby site! </span> |
138 |
| - 🎉🎉🎉 |
139 |
| - </h1> |
140 |
| - <p style={paragraphStyles}> |
141 |
| - Edit <code style={codeStyles}>src/pages/index.tsx</code> to see this |
142 |
| - page update in real-time. 😎 |
143 |
| - </p> |
144 |
| - <ul style={listStyles}> |
145 |
| - <li style={docLinkStyle}> |
146 |
| - <a |
147 |
| - style={linkStyle} |
148 |
| - href={`${docLink.url}?utm_source=starter&utm_medium=ts-docs&utm_campaign=minimal-starter-ts`} |
149 |
| - > |
150 |
| - {docLink.text} |
151 |
| - </a> |
152 |
| - </li> |
153 |
| - {links.map((link) => ( |
154 |
| - <li key={link.url} style={{ ...listItemStyles, color: link.color }}> |
155 |
| - <span> |
156 |
| - <a |
157 |
| - style={linkStyle} |
158 |
| - href={`${link.url}?utm_source=starter&utm_medium=start-page&utm_campaign=minimal-starter-ts`} |
159 |
| - > |
160 |
| - {link.text} |
161 |
| - </a> |
162 |
| - {link.badge && ( |
163 |
| - <span style={badgeStyle} aria-label="New Badge"> |
164 |
| - NEW! |
165 |
| - </span> |
166 |
| - )} |
167 |
| - <p style={descriptionStyle}>{link.description}</p> |
168 |
| - </span> |
169 |
| - </li> |
170 |
| - ))} |
171 |
| - </ul> |
172 |
| - <img |
173 |
| - alt="Gatsby G Logo" |
174 |
| - src="data:image/svg+xml,%3Csvg width='24' height='24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2a10 10 0 110 20 10 10 0 010-20zm0 2c-3.73 0-6.86 2.55-7.75 6L14 19.75c3.45-.89 6-4.02 6-7.75h-5.25v1.5h3.45a6.37 6.37 0 01-3.89 4.44L6.06 9.69C7 7.31 9.3 5.63 12 5.63c2.13 0 4 1.04 5.18 2.65l1.23-1.06A7.959 7.959 0 0012 4zm-8 8a8 8 0 008 8c.04 0 .09 0-8-8z' fill='%23639'/%3E%3C/svg%3E" |
| 15 | + <main className="dark:text-stone-100"> |
| 16 | + <Helmet |
| 17 | + bodyAttributes={{ |
| 18 | + class: "bg-stone-50 dark:bg-stone-800", |
| 19 | + }} |
175 | 20 | />
|
| 21 | + <h1 className="text-2xl md:text-3xl text-center mt-2 mb-1 xl:mt-4"> |
| 22 | + Cursorless Cheatsheet{" "} |
| 23 | + <span className="text-sm inline-block align-middle"> |
| 24 | + <SmartLink to="#legend"> |
| 25 | + <FontAwesomeIcon icon={faCircleQuestion} /> |
| 26 | + </SmartLink> |
| 27 | + </span> |
| 28 | + </h1> |
| 29 | + <Cheatsheet /> |
176 | 30 | </main>
|
177 | 31 | );
|
178 | 32 | };
|
179 | 33 |
|
180 |
| -export default IndexPage; |
| 34 | +const Cheatsheet = () => ( |
| 35 | + <div className="p-2 gap-2 xl:p-4 xl:gap-4 columns-1 md:columns-2 xl:columns-3 xl:max-w-[1600px] xl:mx-auto"> |
| 36 | + {cheatsheetInfo.sections |
| 37 | + .filter((section) => section.items.length > 0) |
| 38 | + .map((section) => ( |
| 39 | + <CheatsheetSection key={section.id}> |
| 40 | + <CheatsheetListComponent section={section} /> |
| 41 | + </CheatsheetSection> |
| 42 | + ))} |
| 43 | + <CheatsheetSection> |
| 44 | + <CheatsheetLegendComponent data={cheatsheetLegend} /> |
| 45 | + </CheatsheetSection> |
| 46 | + <CheatsheetSection> |
| 47 | + <CheatsheetNotesComponent /> |
| 48 | + </CheatsheetSection> |
| 49 | + </div> |
| 50 | +); |
| 51 | + |
| 52 | +const CheatsheetSection: React.FC<{}> = ({ children }) => ( |
| 53 | + <section className=" break-inside-avoid mb-2 xl:mb-4 ">{children}</section> |
| 54 | +); |
| 55 | + |
| 56 | +export default CheatsheetPage; |
0 commit comments