Skip to content

Commit fae0824

Browse files
modernize setup (#821)
* modernize setup * gen-readme
1 parent 62abf7b commit fae0824

14 files changed

Lines changed: 232 additions & 261 deletions

File tree

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Cheatsheet for using React with TypeScript.
105105

106106
<!--START-SECTION:setup-->
107107

108-
### Setup
108+
### Introduction
109109

110110
#### Prerequisites
111111

docs/basic/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: setup
3-
title: Setup
3+
title: Introduction
44
---
55

66
## Prerequisites

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"format": "prettier --write \"**/*.md\"",
2727
"format:check": "prettier --check \"**/*.md\"",
2828
"postinstall": "cd website && yarn",
29-
"prepare": "husky",
3029
"start": "yarn --cwd website start",
3130
"build": "yarn --cwd website build",
3231
"serve": "yarn --cwd website serve"
@@ -37,8 +36,6 @@
3736
"yargs": "^18.0.0"
3837
},
3938
"devDependencies": {
40-
"husky": "^9.1.7",
41-
"prettier": "^3.8.3",
42-
"pretty-quick": "^4.2.2"
39+
"prettier": "^3.8.3"
4340
}
4441
}
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
1-
const { themes } = require("prism-react-renderer");
2-
3-
// List of projects/orgs using your project for the users page.
4-
const users = [
5-
{
6-
caption: "Docusaurus",
7-
image: "https://docusaurus.io/img/docusaurus.svg",
8-
infoLink: "https://docusaurus.io/",
9-
pinned: true,
10-
},
11-
];
1+
import { themes } from "prism-react-renderer";
2+
import type { Config } from "@docusaurus/types";
3+
import type * as Preset from "@docusaurus/preset-classic";
124

135
const setupDoc = "docs/basic/setup";
146

15-
module.exports = {
7+
const config: Config = {
168
favicon: "img/icon.png",
179
title: "React TypeScript Cheatsheet", // Title for your website.
18-
tagline:
19-
"A cheatsheet for experienced React developers getting started with TypeScript",
10+
tagline: "A cheatsheet for developers using React with TypeScript",
2011
url: "https://react-typescript-cheatsheet.netlify.app", // Your website URL
2112
baseUrl: "/",
2213
projectName: "react-typescript-cheatsheet",
2314
organizationName: "typescript-cheatsheets",
2415

2516
presets: [
2617
[
27-
"@docusaurus/preset-classic",
18+
"classic",
2819
{
2920
theme: {
3021
customCss: require.resolve("./src/css/custom.css"),
@@ -37,8 +28,7 @@ module.exports = {
3728
editUrl:
3829
"https://github.com/typescript-cheatsheets/react/tree/main/docs",
3930
},
40-
// ...
41-
},
31+
} satisfies Preset.Options,
4232
],
4333
],
4434

@@ -50,9 +40,6 @@ module.exports = {
5040
image:
5141
"https://user-images.githubusercontent.com/6764957/53868378-2b51fc80-3fb3-11e9-9cee-0277efe8a927.png",
5242

53-
// Equivalent to `docsSideNavCollapsible`.
54-
// sidebarCollapsible: false,
55-
5643
prism: {
5744
defaultLanguage: "typescript",
5845
theme: themes.github,
@@ -68,20 +55,24 @@ module.exports = {
6855
items: [
6956
{
7057
to: setupDoc,
71-
label: "Docs",
58+
label: "Introduction",
59+
position: "right",
60+
},
61+
{
62+
to: "docs/basic/getting-started/basic_type_example",
63+
label: "Learn",
7264
position: "right",
7365
},
7466
{
75-
to: "help",
76-
label: "Help",
67+
to: "docs/reference/ComponentProps",
68+
label: "API Reference",
7769
position: "right",
7870
},
7971
{
8072
to: "https://discord.gg/wTGS5z9",
8173
label: "Discord",
8274
position: "right",
8375
},
84-
// {to: 'blog', label: 'Blog', position: 'right'},
8576
],
8677
},
8778

@@ -90,8 +81,6 @@ module.exports = {
9081
logo: {
9182
alt: "TypeScript Cheatsheets Logo",
9283
src: "img/icon.png",
93-
// maxWidth: 128,
94-
// style: { maxWidth: 128, maxHeight: 128 },
9584
},
9685
copyright: `Copyright © ${new Date().getFullYear()} TypeScript Cheatsheets`,
9786
links: [
@@ -102,6 +91,14 @@ module.exports = {
10291
label: "Introduction",
10392
to: setupDoc,
10493
},
94+
{
95+
label: "Learn",
96+
to: "docs/basic/getting-started/basic_type_example",
97+
},
98+
{
99+
label: "API Reference",
100+
to: "docs/reference/ComponentProps",
101+
},
105102
],
106103
},
107104
{
@@ -111,14 +108,6 @@ module.exports = {
111108
label: "Stack Overflow",
112109
href: "https://stackoverflow.com/questions/tagged/typescript",
113110
},
114-
{
115-
label: "User Showcase",
116-
to: "users",
117-
},
118-
{
119-
label: "Help",
120-
to: "help",
121-
},
122111
{
123112
label: "Contributors",
124113
to: "contributors",
@@ -142,13 +131,11 @@ module.exports = {
142131
</a>`,
143132
},
144133
{
145-
// label: "Discord",
146134
html: `<a class="footer__link-item" href="https://discord.gg/wTGS5z9">
147135
<img src="https://img.shields.io/discord/508357248330760243.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2" style="max-width:100%;" alt="Discord">
148136
</a>`,
149137
},
150138
{
151-
// label: "Spread the word",
152139
html: `<a class="footer__link-item" href="http://twitter.com/home?status=Awesome%20%40Reactjs%20%2B%20%40TypeScript%20cheatsheet%20by%20%40ferdaber%2C%20%40sebsilbermann%2C%20%40swyx%20%26%20others!%20https%3A%2F%2Fgithub.com%2Ftypescript-cheatsheets%2Freact">
153140
<img src="https://img.shields.io/twitter/url?label=Help%20spread%20the%20word%21&style=social&url=https%3A%2F%2Fgithub.com%2Ftypescript-cheatsheets%2Freact" style="max-width:100%;" alt="X">
154141
</a>`,
@@ -162,18 +149,12 @@ module.exports = {
162149
apiKey: "9a22585d1841d2fa758da919cd08a764",
163150
indexName: "react-typescript-cheatsheet",
164151
appId: "J65EL4UPXZ",
165-
algoliaOptions: {
166-
//... },
167-
},
168152
},
169-
},
153+
} satisfies Preset.ThemeConfig,
170154

171155
customFields: {
172156
firstDoc: setupDoc,
173-
174-
// TODO useless user showcase page ?
175-
users,
176-
addUserUrl:
177-
"https://github.com/typescript-cheatsheets/react/blob/main/website/docusaurus.config.js",
178157
},
179158
};
159+
160+
export default config;

website/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
"react": "^19.2.0",
1919
"react-dom": "^19.2.0"
2020
},
21+
"devDependencies": {
22+
"@docusaurus/tsconfig": "^3.10.1",
23+
"@docusaurus/types": "^3.10.1",
24+
"@types/react": "^19.2.0",
25+
"@types/react-dom": "^19.2.0",
26+
"typescript": "^6.0.3"
27+
},
2128
"browserslist": {
2229
"production": [
2330
">0.2%",

website/src/css/custom.css

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,75 @@ main details:hover {
5454
}
5555

5656
.homePageBtns {
57+
display: flex;
58+
flex-wrap: wrap;
59+
gap: 1rem;
60+
justify-content: center;
61+
margin-top: 2rem;
62+
}
63+
64+
.homeSectionGrid {
5765
display: grid;
58-
gap: 20px;
66+
gap: 1.5rem;
67+
grid-template-columns: 1fr;
5968
}
60-
@media (min-width: 480px) {
61-
.homePageBtns {
62-
grid-template-columns: 1fr 1fr;
69+
@media (min-width: 768px) {
70+
.homeSectionGrid {
71+
grid-template-columns: repeat(3, 1fr);
6372
}
6473
}
74+
75+
.homeSectionCard {
76+
display: block;
77+
padding: 1.5rem;
78+
border: 1px solid var(--ifm-color-emphasis-300);
79+
border-radius: var(--ifm-card-border-radius, 0.5rem);
80+
background: var(--ifm-background-surface-color);
81+
color: inherit;
82+
text-decoration: none;
83+
transition:
84+
transform 0.15s ease,
85+
border-color 0.15s ease,
86+
box-shadow 0.15s ease;
87+
}
88+
.homeSectionCard:hover {
89+
text-decoration: none;
90+
color: inherit;
91+
border-color: var(--ifm-color-primary);
92+
transform: translateY(-2px);
93+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
94+
}
95+
.homeSectionCard h3 {
96+
margin: 0 0 0.5rem;
97+
color: var(--ifm-color-primary);
98+
}
99+
.homeSectionCard p {
100+
margin: 0;
101+
color: var(--ifm-color-emphasis-700);
102+
font-size: 0.95rem;
103+
}
104+
105+
.homeTopicsGrid {
106+
display: flex;
107+
flex-wrap: wrap;
108+
gap: 0.75rem;
109+
justify-content: center;
110+
}
111+
.homeTopicLink {
112+
padding: 0.5rem 1rem;
113+
border: 1px solid var(--ifm-color-emphasis-300);
114+
border-radius: 999px;
115+
font-size: 0.9rem;
116+
color: var(--ifm-color-emphasis-800);
117+
text-decoration: none;
118+
transition:
119+
border-color 0.15s ease,
120+
color 0.15s ease,
121+
background 0.15s ease;
122+
}
123+
.homeTopicLink:hover {
124+
border-color: var(--ifm-color-primary);
125+
color: var(--ifm-color-primary);
126+
background: var(--ifm-color-primary-contrast-background, transparent);
127+
text-decoration: none;
128+
}

website/src/pages/help.js

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

website/src/pages/index.js

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

0 commit comments

Comments
 (0)