Skip to content

Commit df529fb

Browse files
authored
V4 (#1361)
* Move html colors to classes * Refactor routing and navbar * Unify SEO definitions, set some base url and email strings * Lots of refactoring, cleaning up, polish * Fix variable fonts, typography, some dark mode polish * Clean up bookmarks, ama, about * Fix stack font weight * Restructure pages, make mono default type * Polish and pages cleanup * Projects pages cleanup * Dark mode polish * Start repopulating home * Copy, type polish * Work on changelog * Fix 404, typescript errors * Responsive polish and cleanup * Yarn and fix tests * Remove husky
1 parent 83dfcf3 commit df529fb

File tree

140 files changed

+2984
-4062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2984
-4062
lines changed

.eslintrc.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"plugin:react/recommended",
55
"plugin:@typescript-eslint/recommended",
66
"prettier/@typescript-eslint",
7-
"plugin:prettier/recommended",
8-
"plugin:mdx/recommended"
7+
"plugin:prettier/recommended"
98
],
109
"plugins": [
1110
"react",

cypress/integration/home_spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe.skip('Home', () => {
1414
})
1515
})
1616

17-
it('should render overthought', () => {
18-
cy.contains('Overthought').scrollIntoView().should('be.visible')
17+
it('should render writing', () => {
18+
cy.contains('Writing').scrollIntoView().should('be.visible')
1919
})
2020
})

cypress/integration/overthought_post_spec.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
/// <reference types="cypress" />
22
/// <reference types="@testing-library/cypress" />
33

4-
describe('Overthought index', () => {
4+
describe('Posts index', () => {
55
it('should render post', () => {
6-
cy.visit('/overthought/adding-dark-mode-with-next-js')
7-
cy.get('[data-cy="overthought-post"]').scrollIntoView().should('be.visible')
6+
cy.visit('/writing/adding-dark-mode-with-next-js')
7+
cy.get('[data-cy="post"]').scrollIntoView().should('be.visible')
88
})
99

1010
it('should render 404', () => {
11-
cy.visit('/overthought/foobar')
11+
cy.visit('/writing/foobar')
1212
cy.wait(1000)
13-
cy.get('[data-cy="overthought-not-found"]')
14-
.scrollIntoView()
15-
.should('be.visible')
13+
cy.get('[data-cy="post-not-found"]').scrollIntoView().should('be.visible')
1614
})
1715

1816
it('should render newsletter', () => {
19-
cy.visit('/overthought/adding-dark-mode-with-next-js')
20-
cy.get('[data-cy="overthought-subscribe-box"]')
17+
cy.visit('/writing/adding-dark-mode-with-next-js')
18+
cy.get('[data-cy="writing-feedback-box"]')
19+
.scrollIntoView()
20+
.should('be.visible')
21+
cy.get('[data-cy="writing-subscribe-box"]')
2122
.scrollIntoView()
2223
.should('be.visible')
2324
})

cypress/integration/overthought_spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/// <reference types="cypress" />
22
/// <reference types="@testing-library/cypress" />
33

4-
describe('Overthought index', () => {
4+
describe('Posts index', () => {
55
before(() => {
6-
cy.visit('/overthought')
6+
cy.visit('/writing')
77
})
88

99
it('should render header', () => {
10-
cy.get('[data-cy="overthought"]').scrollIntoView().should('be.visible')
10+
cy.get('[data-cy="writing"]').scrollIntoView().should('be.visible')
1111
})
1212

1313
it('should render newsletter', () => {
14-
cy.get('[data-cy="overthought-subscribe-box"]')
14+
cy.get('[data-cy="writing-subscribe-box"]')
1515
.scrollIntoView()
1616
.should('be.visible')
1717
})

next.config.js

+37-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
1-
const path = require('path')
2-
const withMDX = require('@next/mdx')({
3-
extension: /\.mdx?$/,
4-
})
5-
6-
module.exports = withMDX({
7-
pageExtensions: ['ts', 'tsx', 'mdx'],
1+
module.exports = {
82
images: {
9-
domains: ['pbs.twimg.com'],
3+
domains: ['pbs.twimg.com', 'overthought.ghost.io'],
104
},
115
env: {
126
FATHOM_SITE_ID: process.env.FATHOM_SITE_ID,
137
FATHOM_CUSTOM_URL: process.env.FATHOM_CUSTOM_URL,
148
GHOST_API_KEY: process.env.GHOST_API_KEY,
159
SIMPLECAST_V2_API_KEY: process.env.SIMPLECAST_V2_API_KEY,
1610
},
17-
})
11+
async redirects() {
12+
return [
13+
{
14+
source: '/uses',
15+
destination: '/stack',
16+
permanent: true,
17+
},
18+
{
19+
source: '/design-details',
20+
destination: '/app-dissection',
21+
permanent: true,
22+
},
23+
{
24+
source: '/design-details/:slug',
25+
destination: '/app-dissection/:slug',
26+
permanent: true,
27+
},
28+
{
29+
source: '/journal',
30+
destination: '/writing',
31+
permanent: true,
32+
},
33+
{
34+
source: '/overthought',
35+
destination: '/writing',
36+
permanent: true,
37+
},
38+
{
39+
source: '/overthought/:slug',
40+
destination: '/writing/:slug',
41+
permanent: true,
42+
},
43+
]
44+
},
45+
}

package.json

+3-15
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
"@apollo/client": "^3.3.10",
2323
"@apollo/link-error": "^2.0.0-beta.3",
2424
"@apollo/link-schema": "^2.0.0-beta.3",
25-
"@mdx-js/loader": "^1.6.22",
26-
"@mdx-js/react": "^1.6.22",
27-
"@next/bundle-analyzer": "^10.0.6",
28-
"@next/mdx": "^10.0.6",
29-
"@now/node": "^1.8.5",
3025
"@tailwindcss/forms": "^0.2.1",
3126
"@tailwindcss/typography": "^0.4.0",
3227
"@tippy.js/react": "^3.1.1",
@@ -47,15 +42,11 @@
4742
"postmark": "^2.7.1",
4843
"prismjs": "^1.23.0",
4944
"react": "^17.0.1",
50-
"react-clipboard.js": "^2.0.16",
5145
"react-dom": "^17.0.1",
5246
"react-feather": "^2.0.9",
53-
"react-flip-move": "^3.0.4",
5447
"react-linkify": "^1.0.0-alpha",
5548
"react-markdown": "^5.0.3",
5649
"react-visibility-sensor": "^5.1.1",
57-
"rebass": "^4.0.7",
58-
"reflexbox": "^4.0.6",
5950
"rehype-parse": "^7.0.1",
6051
"rehype-remark": "^8.0.0",
6152
"remark-preset-lint-recommended": "^5.0.0",
@@ -64,9 +55,6 @@
6455
"serve-favicon": "^2.5.0",
6556
"string-replace-to-array": "^1.0.3",
6657
"styled-components": "^4.4.1",
67-
"terser": "^5.6.0",
68-
"theme-ui": "^0.3.5",
69-
"throttle-debounce": "^3.0.1",
7058
"timeago.js": "^4.0.2",
7159
"twilio": "^3.57.0",
7260
"unified": "^9.2.1",
@@ -93,14 +81,14 @@
9381
"autoprefixer": "^10.2.4",
9482
"babel-eslint": "^10.1.0",
9583
"babel-plugin-styled-components": "^1.12.0",
96-
"cypress": "6.5.0",
84+
"cypress": "^6.6.0",
9785
"eslint": "^7.21.0",
9886
"eslint-config-prettier": "^7.2.0",
9987
"eslint-plugin-cypress": "^2.11.2",
10088
"eslint-plugin-mdx": "^1.9.0",
10189
"eslint-plugin-prettier": "^3.3.1",
10290
"eslint-plugin-react": "^7.22.0",
103-
"husky": "^5.1.2",
91+
"husky": "^5.1.3",
10492
"lint-staged": "^10.5.4",
10593
"now-env": "^3.2.0",
10694
"postcss": "^8.2.5",
@@ -123,4 +111,4 @@
123111
},
124112
"pre-commit": "lint:staged && generate",
125113
"license": "MIT"
126-
}
114+
}
56.6 KB
Binary file not shown.
44.2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
50.6 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
160 KB
Binary file not shown.
-3.24 KB
Binary file not shown.
-2.47 KB
Binary file not shown.
Binary file not shown.
-3.26 KB
Binary file not shown.
Binary file not shown.
-3.41 KB
Binary file not shown.
-1.55 KB
Binary file not shown.
-1.41 KB
Binary file not shown.

src/components/AMAQuestions/AskQuestion.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from 'react'
22
import { useAddAmaQuestionMutation } from '~/graphql/types.generated'
33
import { Textarea } from '~/components/Input'
4+
import { ErrorAlert, SuccessAlert } from '../Alert'
5+
import Button from '../Button'
46

57
export default function AddBookmark() {
68
const [question, setQuestion] = React.useState('')
@@ -37,7 +39,7 @@ export default function AddBookmark() {
3739
}
3840

3941
return (
40-
<form className="flex flex-col items-stretch space-y-4" onSubmit={onSubmit}>
42+
<form className="items-stretch space-y-4" onSubmit={onSubmit}>
4143
<Textarea
4244
value={question}
4345
placeholder="Ask me anything..."
@@ -46,16 +48,14 @@ export default function AddBookmark() {
4648
/>
4749
{question.length > 0 && (
4850
<div className="flex self-end">
49-
<button className="btn btn-primary" onClick={onSubmit}>
50-
Ask away!
51-
</button>
51+
<Button onClick={onSubmit}>Ask away!</Button>
5252
</div>
5353
)}
54-
{error && <p className="text-red-500">{error}</p>}
54+
{error && <ErrorAlert>{error}</ErrorAlert>}
5555
{success && (
56-
<p className="text-green-500">
56+
<SuccessAlert>
5757
Thanks for asking! I’ll reply soon, so feel free to check back 👋
58-
</p>
58+
</SuccessAlert>
5959
)}
6060
</form>
6161
)

src/components/AMAQuestions/EditQuestion.tsx

+6-12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '~/graphql/types.generated'
88
import { GET_AMA_QUESTIONS } from '~/graphql/queries'
99
import { Textarea } from '~/components/Input'
10+
import Button from '../Button'
1011

1112
interface Props {
1213
question: Ama
@@ -160,7 +161,7 @@ export default function EditQuestion(props: Props) {
160161
}
161162

162163
return (
163-
<form className="flex flex-col space-y-4" onSubmit={handleSave}>
164+
<form className="space-y-4" onSubmit={handleSave}>
164165
<Textarea
165166
placeholder="Question"
166167
value={state.question}
@@ -169,7 +170,6 @@ export default function EditQuestion(props: Props) {
169170
/>
170171

171172
<Textarea
172-
autoFocus
173173
placeholder="Answer..."
174174
value={state.answer}
175175
onChange={onAnswerChange}
@@ -179,18 +179,12 @@ export default function EditQuestion(props: Props) {
179179

180180
{state.error && <p className="text-red-500">{state.error}</p>}
181181

182-
<div className="flex space-between justify-between">
182+
<div className="flex justify-between space-between">
183+
<Button onClick={() => handleDelete()}>Delete</Button>
183184
<div className="flex space-x-3">
184-
<button className="text-blue-500" onClick={handleSave}>
185-
Save
186-
</button>
187-
<button className="black-link" onClick={onDone}>
188-
Cancel
189-
</button>
185+
<Button onClick={onDone}>Cancel</Button>
186+
<Button onClick={handleSave}>Save</Button>
190187
</div>
191-
<button className="text-red-500" onClick={() => handleDelete()}>
192-
Delete
193-
</button>
194188
</div>
195189
</form>
196190
)

src/components/AMAQuestions/PendingQuestions.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function PendingQuestion() {
2222
if (!data || !data.amaQuestions) return null
2323

2424
return (
25-
<div className="flex flex-col space-y-8">
25+
<div className=" space-y-8">
2626
{data.amaQuestions.map((question) => (
2727
<QuestionItem editable={true} key={question.id} question={question} />
2828
))}

src/components/AMAQuestions/QuestionItem.tsx

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { format } from 'timeago.js'
44
import QuestionReaction from './QuestionReaction'
55
import EditQuestion from './EditQuestion'
66
import MarkdownRenderer from '../MarkdownRenderer'
7+
import Linkify from '../Linkify'
78

89
interface Props {
910
editable: boolean
@@ -28,39 +29,37 @@ export const QuestionItem = React.memo((props: Props) => {
2829
}
2930

3031
return (
31-
<div className="flex flex-col space-y-2">
32-
<p className="font-bold">{question.question}</p>
32+
<div className="space-y-1 ">
33+
<span>
34+
<p className="font-medium text-primary">{question.question}</p>
35+
</span>
3336
{question.answer && (
34-
<div className="prose lg:prose-lg flex flex-col">
35-
<MarkdownRenderer>{question.answer}</MarkdownRenderer>
36-
</div>
37+
<p className="text-tertiary clamp-3">
38+
<Linkify>{question.answer}</Linkify>
39+
</p>
3740
)}
38-
39-
<div className="flex items-center space-x-3">
41+
<span className="flex items-center space-x-2 text-tertiary">
4042
<QuestionReaction question={question} />
41-
42-
<span className="divider-gray">/</span>
43+
<span className="text-quaternary">{' · '}</span>
4344

4445
<p
45-
className={`p-small ${
46-
question.answer ? 'text-gray-700' : 'text-yellow-500'
47-
}`}
46+
className={`${question.answer ? 'text-tertiary' : 'text-yellow-500'}`}
4847
>
49-
{question.answer ? 'Updated' : 'Asked'} {format(updatedAt)}
48+
{format(updatedAt)}
5049
</p>
5150

5251
{editable && (
5352
<div className="flex space-x-2">
54-
<span className="divider-gray">/</span>
53+
<span className="text-quaternary">·</span>
5554
<button
56-
className="p-small black-link"
55+
className="text-tertiary hover:text-gray-1000 dark:hover:text-gray-50"
5756
onClick={() => setIsEditing(true)}
5857
>
5958
Edit
6059
</button>
6160
</div>
6261
)}
63-
</div>
62+
</span>
6463
</div>
6564
)
6665
})

src/components/AMAQuestions/QuestionReaction.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function QuestionReaction(props: Props) {
2828

2929
return (
3030
<button
31-
className="flex space-x-2 items-center focus:ring-opacity-0"
31+
className="flex items-center space-x-2 focus:ring-opacity-0"
3232
onClick={handleReaction}
3333
>
3434
<svg
@@ -42,14 +42,12 @@ export default function QuestionReaction(props: Props) {
4242
fillRule="evenodd"
4343
clipRule="evenodd"
4444
className={`fill-current ${
45-
question.reactions > 0
46-
? 'text-red-500'
47-
: 'text-gray-400 dark:text-gray-600'
45+
question.reactions > 0 ? 'text-red-500' : 'text-quaternary'
4846
}`}
4947
d="M7.655 14.9159C7.65523 14.9161 7.65543 14.9162 8 14.25C8.34457 14.9162 8.34477 14.9161 8.34501 14.9159C8.12889 15.0277 7.87111 15.0277 7.655 14.9159ZM7.655 14.9159L8 14.25L8.34501 14.9159L8.34731 14.9147L8.35269 14.9119L8.37117 14.9022C8.38687 14.8939 8.40926 14.882 8.4379 14.8665C8.49516 14.8356 8.57746 14.7904 8.6812 14.7317C8.8886 14.6142 9.18229 14.442 9.53358 14.2199C10.2346 13.7767 11.1728 13.13 12.1147 12.3181C13.9554 10.7312 16 8.35031 16 5.5C16 2.83579 13.9142 1 11.75 1C10.2026 1 8.84711 1.80151 8 3.01995C7.15289 1.80151 5.79736 1 4.25 1C2.08579 1 0 2.83579 0 5.5C0 8.35031 2.04459 10.7312 3.8853 12.3181C4.82717 13.13 5.76538 13.7767 6.46642 14.2199C6.81771 14.442 7.1114 14.6142 7.3188 14.7317C7.42254 14.7904 7.50484 14.8356 7.5621 14.8665C7.59074 14.882 7.61313 14.8939 7.62883 14.9022L7.64731 14.9119L7.65269 14.9147L7.655 14.9159Z"
5048
></path>
5149
</svg>
52-
<span className="p-small">{question.reactions.toLocaleString()}</span>
50+
<span>{question.reactions.toLocaleString()}</span>
5351
</button>
5452
)
5553
}

0 commit comments

Comments
 (0)