Skip to content

Commit

Permalink
regression unist-visit
Browse files Browse the repository at this point in the history
  • Loading branch information
jj committed Apr 21, 2021
1 parent 4fd9e63 commit ba93b02
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rehype-react": "^6.2.0",
"rss": "^1.2.2",
"sanitize-html": "^2.3.3",
"unist-util-visit": "^3.0.0"
"unist-util-visit": "^2.0.3"
},
"devDependencies": {
"@next/bundle-analyzer": "^10.1.3",
Expand Down
53 changes: 53 additions & 0 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

import Link from 'next/link'
import { GetStaticProps } from 'next'

import { Layout } from '@components/Layout'
import { HeaderPage } from '@components/HeaderPage'
import { PostCard } from '@components/PostCard'

import { getAllPosts, getAllSettings, GhostSettings, GhostPostsOrPages } from '@lib/ghost'
import { useLang, get } from '@utils/use-lang'
import { BodyClass } from '@helpers/BodyClass'

export const getStaticProps: GetStaticProps = async () => {
const posts = await getAllPosts({ limit: 3 })
const settings = await getAllSettings()

return {
props: {
settings,
posts,
bodyClass: BodyClass({})
},
}
}

interface Custom404Props {
posts: GhostPostsOrPages
settings: GhostSettings
bodyClass: string
}

export default function Custom404({ posts, settings, bodyClass }: Custom404Props) {
const text = get(useLang())

return (
<Layout {...{ settings, bodyClass }} header={<HeaderPage {...{ settings }} />} errorClass="error-content">
<div className="inner">
<section className="error-message">
<h1 className="error-code">404</h1>
<p className="error-description">{text(`PAGE_NOT_FOUND`)}</p>
<Link href="/" ><a className="error-link">{text(`GOTO_FRONT_PAGE`)}</a></Link>
</section>

<div className="post-feed">
{posts.map((post, i) => (
<PostCard key={post.id} {...{ settings, post, num: i }} />
))}
</div>

</div>
</Layout>
)
}
27 changes: 11 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4366,11 +4366,6 @@ unist-util-is@^4.0.0:
resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-4.0.4.tgz#3e9e8de6af2eb0039a59f50c9b3e99698a924f50"
integrity sha512-3dF39j/u423v4BBQrk1AQ2Ve1FxY5W3JKwXxVFzBODQ6WEvccguhgp802qQLKSnxPODE6WuRZtV+ohlUg4meBA==

unist-util-is@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-5.0.0.tgz#c71eddea34aa7009d54f671a6fafb3779b8035d3"
integrity sha512-G4p13DhfdUNmlnJxd0uy5Skx1FG58LSDhX8h1xgpeSq0omOQ4ZN5BO54ToFlNX55NDTbRHMdwTOJXqAieInSEA==

unist-util-stringify-position@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz#cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da"
Expand All @@ -4385,13 +4380,13 @@ unist-util-visit-parents@^2.0.0:
dependencies:
unist-util-is "^3.0.0"

unist-util-visit-parents@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-4.0.0.tgz#0dfc00046ac753517ffaaf59b80d1ac892b352a6"
integrity sha512-QyATSx30wHguIzI82+GVeuXGnFlh3AUVcyeZPOo5Paz2Z52zfRe3/0WLlBv6XlMWcr5xEdFqox6PteUL6hzEFA==
unist-util-visit-parents@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz#65a6ce698f78a6b0f56aa0e88f13801886cdaef6"
integrity sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==
dependencies:
"@types/unist" "^2.0.0"
unist-util-is "^5.0.0"
unist-util-is "^4.0.0"

unist-util-visit@^1.3.0:
version "1.4.1"
Expand All @@ -4400,14 +4395,14 @@ unist-util-visit@^1.3.0:
dependencies:
unist-util-visit-parents "^2.0.0"

unist-util-visit@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-3.0.0.tgz#a8e239038f7b29aadc649a6080f42bc85ea1a7bc"
integrity sha512-RbFwAZhMekKPZxlAhUIiBwim8NogwUtwLbIjvZehaGORYRDWcApsnGI1VDUHr/Jo6yW1u8VOqO/djbd7Hpz88A==
unist-util-visit@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.3.tgz#c3703893146df47203bb8a9795af47d7b971208c"
integrity sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==
dependencies:
"@types/unist" "^2.0.0"
unist-util-is "^5.0.0"
unist-util-visit-parents "^4.0.0"
unist-util-is "^4.0.0"
unist-util-visit-parents "^3.0.0"

[email protected]:
version "1.0.0"
Expand Down

2 comments on commit ba93b02

@vercel
Copy link

@vercel vercel bot commented on ba93b02 Apr 21, 2021

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on ba93b02 Apr 22, 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.