Skip to content

Commit

Permalink
V4 (#1361)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
brianlovin authored Mar 8, 2021
1 parent 83dfcf3 commit df529fb
Show file tree
Hide file tree
Showing 140 changed files with 2,984 additions and 4,062 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:mdx/recommended"
"plugin:prettier/recommended"
],
"plugins": [
"react",
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/home_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe.skip('Home', () => {
})
})

it('should render overthought', () => {
cy.contains('Overthought').scrollIntoView().should('be.visible')
it('should render writing', () => {
cy.contains('Writing').scrollIntoView().should('be.visible')
})
})
19 changes: 10 additions & 9 deletions cypress/integration/overthought_post_spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/// <reference types="cypress" />
/// <reference types="@testing-library/cypress" />

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

it('should render 404', () => {
cy.visit('/overthought/foobar')
cy.visit('/writing/foobar')
cy.wait(1000)
cy.get('[data-cy="overthought-not-found"]')
.scrollIntoView()
.should('be.visible')
cy.get('[data-cy="post-not-found"]').scrollIntoView().should('be.visible')
})

it('should render newsletter', () => {
cy.visit('/overthought/adding-dark-mode-with-next-js')
cy.get('[data-cy="overthought-subscribe-box"]')
cy.visit('/writing/adding-dark-mode-with-next-js')
cy.get('[data-cy="writing-feedback-box"]')
.scrollIntoView()
.should('be.visible')
cy.get('[data-cy="writing-subscribe-box"]')
.scrollIntoView()
.should('be.visible')
})
Expand Down
8 changes: 4 additions & 4 deletions cypress/integration/overthought_spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/// <reference types="cypress" />
/// <reference types="@testing-library/cypress" />

describe('Overthought index', () => {
describe('Posts index', () => {
before(() => {
cy.visit('/overthought')
cy.visit('/writing')
})

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

it('should render newsletter', () => {
cy.get('[data-cy="overthought-subscribe-box"]')
cy.get('[data-cy="writing-subscribe-box"]')
.scrollIntoView()
.should('be.visible')
})
Expand Down
46 changes: 37 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
const path = require('path')
const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
})

module.exports = withMDX({
pageExtensions: ['ts', 'tsx', 'mdx'],
module.exports = {
images: {
domains: ['pbs.twimg.com'],
domains: ['pbs.twimg.com', 'overthought.ghost.io'],
},
env: {
FATHOM_SITE_ID: process.env.FATHOM_SITE_ID,
FATHOM_CUSTOM_URL: process.env.FATHOM_CUSTOM_URL,
GHOST_API_KEY: process.env.GHOST_API_KEY,
SIMPLECAST_V2_API_KEY: process.env.SIMPLECAST_V2_API_KEY,
},
})
async redirects() {
return [
{
source: '/uses',
destination: '/stack',
permanent: true,
},
{
source: '/design-details',
destination: '/app-dissection',
permanent: true,
},
{
source: '/design-details/:slug',
destination: '/app-dissection/:slug',
permanent: true,
},
{
source: '/journal',
destination: '/writing',
permanent: true,
},
{
source: '/overthought',
destination: '/writing',
permanent: true,
},
{
source: '/overthought/:slug',
destination: '/writing/:slug',
permanent: true,
},
]
},
}
18 changes: 3 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"@apollo/client": "^3.3.10",
"@apollo/link-error": "^2.0.0-beta.3",
"@apollo/link-schema": "^2.0.0-beta.3",
"@mdx-js/loader": "^1.6.22",
"@mdx-js/react": "^1.6.22",
"@next/bundle-analyzer": "^10.0.6",
"@next/mdx": "^10.0.6",
"@now/node": "^1.8.5",
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/typography": "^0.4.0",
"@tippy.js/react": "^3.1.1",
Expand All @@ -47,15 +42,11 @@
"postmark": "^2.7.1",
"prismjs": "^1.23.0",
"react": "^17.0.1",
"react-clipboard.js": "^2.0.16",
"react-dom": "^17.0.1",
"react-feather": "^2.0.9",
"react-flip-move": "^3.0.4",
"react-linkify": "^1.0.0-alpha",
"react-markdown": "^5.0.3",
"react-visibility-sensor": "^5.1.1",
"rebass": "^4.0.7",
"reflexbox": "^4.0.6",
"rehype-parse": "^7.0.1",
"rehype-remark": "^8.0.0",
"remark-preset-lint-recommended": "^5.0.0",
Expand All @@ -64,9 +55,6 @@
"serve-favicon": "^2.5.0",
"string-replace-to-array": "^1.0.3",
"styled-components": "^4.4.1",
"terser": "^5.6.0",
"theme-ui": "^0.3.5",
"throttle-debounce": "^3.0.1",
"timeago.js": "^4.0.2",
"twilio": "^3.57.0",
"unified": "^9.2.1",
Expand All @@ -93,14 +81,14 @@
"autoprefixer": "^10.2.4",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^1.12.0",
"cypress": "6.5.0",
"cypress": "^6.6.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-mdx": "^1.9.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"husky": "^5.1.2",
"husky": "^5.1.3",
"lint-staged": "^10.5.4",
"now-env": "^3.2.0",
"postcss": "^8.2.5",
Expand All @@ -123,4 +111,4 @@
},
"pre-commit": "lint:staged && generate",
"license": "MIT"
}
}
Binary file added public/static/fonts/iAWriterQuattroS-Bold.woff
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroS-Bold.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroS-Italic.woff
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroS-Italic.woff2
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroS-Regular.woff
Binary file not shown.
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroV-Italic.ttf
Binary file not shown.
Binary file added public/static/fonts/iAWriterQuattroV.ttf
Binary file not shown.
Binary file removed public/static/img/subscription_icons/breaker.png
Binary file not shown.
Binary file removed public/static/img/subscription_icons/castro.png
Binary file not shown.
Binary file not shown.
Binary file removed public/static/img/subscription_icons/overcast.png
Binary file not shown.
Binary file not shown.
Binary file removed public/static/img/subscription_icons/podcasts.png
Binary file not shown.
Binary file removed public/static/img/subscription_icons/rss.png
Binary file not shown.
Binary file removed public/static/img/subscription_icons/spotify.png
Binary file not shown.
14 changes: 7 additions & 7 deletions src/components/AMAQuestions/AskQuestion.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react'
import { useAddAmaQuestionMutation } from '~/graphql/types.generated'
import { Textarea } from '~/components/Input'
import { ErrorAlert, SuccessAlert } from '../Alert'
import Button from '../Button'

export default function AddBookmark() {
const [question, setQuestion] = React.useState('')
Expand Down Expand Up @@ -37,7 +39,7 @@ export default function AddBookmark() {
}

return (
<form className="flex flex-col items-stretch space-y-4" onSubmit={onSubmit}>
<form className="items-stretch space-y-4" onSubmit={onSubmit}>
<Textarea
value={question}
placeholder="Ask me anything..."
Expand All @@ -46,16 +48,14 @@ export default function AddBookmark() {
/>
{question.length > 0 && (
<div className="flex self-end">
<button className="btn btn-primary" onClick={onSubmit}>
Ask away!
</button>
<Button onClick={onSubmit}>Ask away!</Button>
</div>
)}
{error && <p className="text-red-500">{error}</p>}
{error && <ErrorAlert>{error}</ErrorAlert>}
{success && (
<p className="text-green-500">
<SuccessAlert>
Thanks for asking! I’ll reply soon, so feel free to check back 👋
</p>
</SuccessAlert>
)}
</form>
)
Expand Down
18 changes: 6 additions & 12 deletions src/components/AMAQuestions/EditQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '~/graphql/types.generated'
import { GET_AMA_QUESTIONS } from '~/graphql/queries'
import { Textarea } from '~/components/Input'
import Button from '../Button'

interface Props {
question: Ama
Expand Down Expand Up @@ -160,7 +161,7 @@ export default function EditQuestion(props: Props) {
}

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

<Textarea
autoFocus
placeholder="Answer..."
value={state.answer}
onChange={onAnswerChange}
Expand All @@ -179,18 +179,12 @@ export default function EditQuestion(props: Props) {

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

<div className="flex space-between justify-between">
<div className="flex justify-between space-between">
<Button onClick={() => handleDelete()}>Delete</Button>
<div className="flex space-x-3">
<button className="text-blue-500" onClick={handleSave}>
Save
</button>
<button className="black-link" onClick={onDone}>
Cancel
</button>
<Button onClick={onDone}>Cancel</Button>
<Button onClick={handleSave}>Save</Button>
</div>
<button className="text-red-500" onClick={() => handleDelete()}>
Delete
</button>
</div>
</form>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/AMAQuestions/PendingQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function PendingQuestion() {
if (!data || !data.amaQuestions) return null

return (
<div className="flex flex-col space-y-8">
<div className=" space-y-8">
{data.amaQuestions.map((question) => (
<QuestionItem editable={true} key={question.id} question={question} />
))}
Expand Down
31 changes: 15 additions & 16 deletions src/components/AMAQuestions/QuestionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { format } from 'timeago.js'
import QuestionReaction from './QuestionReaction'
import EditQuestion from './EditQuestion'
import MarkdownRenderer from '../MarkdownRenderer'
import Linkify from '../Linkify'

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

return (
<div className="flex flex-col space-y-2">
<p className="font-bold">{question.question}</p>
<div className="space-y-1 ">
<span>
<p className="font-medium text-primary">{question.question}</p>
</span>
{question.answer && (
<div className="prose lg:prose-lg flex flex-col">
<MarkdownRenderer>{question.answer}</MarkdownRenderer>
</div>
<p className="text-tertiary clamp-3">
<Linkify>{question.answer}</Linkify>
</p>
)}

<div className="flex items-center space-x-3">
<span className="flex items-center space-x-2 text-tertiary">
<QuestionReaction question={question} />

<span className="divider-gray">/</span>
<span className="text-quaternary">{' · '}</span>

<p
className={`p-small ${
question.answer ? 'text-gray-700' : 'text-yellow-500'
}`}
className={`${question.answer ? 'text-tertiary' : 'text-yellow-500'}`}
>
{question.answer ? 'Updated' : 'Asked'} {format(updatedAt)}
{format(updatedAt)}
</p>

{editable && (
<div className="flex space-x-2">
<span className="divider-gray">/</span>
<span className="text-quaternary">·</span>
<button
className="p-small black-link"
className="text-tertiary hover:text-gray-1000 dark:hover:text-gray-50"
onClick={() => setIsEditing(true)}
>
Edit
</button>
</div>
)}
</div>
</span>
</div>
)
})
8 changes: 3 additions & 5 deletions src/components/AMAQuestions/QuestionReaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function QuestionReaction(props: Props) {

return (
<button
className="flex space-x-2 items-center focus:ring-opacity-0"
className="flex items-center space-x-2 focus:ring-opacity-0"
onClick={handleReaction}
>
<svg
Expand All @@ -42,14 +42,12 @@ export default function QuestionReaction(props: Props) {
fillRule="evenodd"
clipRule="evenodd"
className={`fill-current ${
question.reactions > 0
? 'text-red-500'
: 'text-gray-400 dark:text-gray-600'
question.reactions > 0 ? 'text-red-500' : 'text-quaternary'
}`}
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"
></path>
</svg>
<span className="p-small">{question.reactions.toLocaleString()}</span>
<span>{question.reactions.toLocaleString()}</span>
</button>
)
}
Loading

1 comment on commit df529fb

@vercel
Copy link

@vercel vercel bot commented on df529fb Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.