Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextra 2 #390

Merged
merged 21 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions components/blog-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@ import Link from "next/link";

export default function BlogIndex({ more = "Read more" }) {
return getPagesUnderRoute("/blog").map((page) => {
// Alias `<a>` to avoid it being replaced by MDX components.
const A = "a";
return (
<div className="">
<div className="mb-10">
<h3>
<Link href={page.route}>
<A style={{ color: "inherit", textDecoration: "none" }}>
{page.meta?.title || page.frontMatter?.title || page.name}
</A>
<Link
href={page.route}
style={{ color: "inherit", textDecoration: "none" }}
className="block font-semibold mt-8 text-2xl "
>
{page.meta?.title || page.frontMatter?.title || page.name}
</Link>
</h3>
<p className="opacity-80">
<p className="opacity-80 mt-6 leading-7">
{page.frontMatter?.description}{" "}
<Link href={page.route}>{more + " →"}</Link>
<span className="inline-block">
<Link
href={page.route}
className="text-[color:hsl(var(--nextra-primary-hue),100%,50%)] underline underline-offset-2 decoration-from-font"
>
{more + " →"}
</Link>
</span>
</p>
{page.frontMatter?.date ? (
<p className="opacity-50 text-sm">{page.frontMatter.date}</p>
<p className="opacity-50 text-sm mt-6 leading-7">
{page.frontMatter.date}
</p>
) : null}
</div>
);
Expand Down
10 changes: 7 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.js",
unstable_flexsearch: true,
unstable_staticImage: true,
staticImage: true,
flexsearch: {
codeblocks: false,
},
defaultShowCopyCode: true,
});

module.exports = withNextra({
Expand Down Expand Up @@ -35,7 +38,7 @@ module.exports = withNextra({
{
source: "/docs/options",
destination: "/docs/api",
statusCode: 301
statusCode: 301,
},
{
source: "/change-log",
Expand All @@ -59,4 +62,5 @@ module.exports = withNextra({
},
];
},
reactStrictMode: true,
});
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
"author": "Shu Ding",
"license": "Apache-2.0",
"dependencies": {
"@reach/skip-nav": "^0.16.0",
"focus-visible": "^5.1.0",
"@vercel/analytics": "^0.1.6",
"focus-visible": "^5.2.0",
"intersection-observer": "^0.10.0",
"markdown-to-jsx": "^6.11.4",
"next": "^12.2.0",
"nextra": "^2.0.0-beta.6",
"nextra-theme-docs": "^2.0.0-beta.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"next": "^13.1.1",
"nextra": "^2.0.2",
"nextra-theme-docs": "^2.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intersection-observer": "^8.26.2"
},
"devDependencies": {
"autoprefixer": "^10.4.2",
"postcss": "^8.4.5",
"tailwindcss": "^3.0.16"
"autoprefixer": "^10.4.13",
"postcss": "^8.4.19",
"tailwindcss": "^3.2.4"
},
"prettier": {
"embeddedLanguageFormatting": "off",
Expand Down
10 changes: 7 additions & 3 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import "../styles.css";
import "nextra-theme-docs/style.css";
import { Analytics } from "@vercel/analytics/react";

export default function Nextra({ Component, pageProps }) {
const getLayout = Component.getLayout || ((page) => page);
return getLayout(<Component {...pageProps} />);
return (
<>
<Component {...pageProps} />
<Analytics />
</>
);
}
6 changes: 3 additions & 3 deletions pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from 'react'
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { SkipNavLink } from '@reach/skip-nav'
import { SkipNavLink } from "nextra-theme-docs";

class MyDocument extends Document {
render() {
return (
<Html lang="en">
<Head />
<body>
<SkipNavLink />
<SkipNavLink styled />
<Main />
<NextScript />
</body>
</Html>
)
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pages/meta.en-US.json → pages/_meta.en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "Introduction",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "Docs",
Expand Down
2 changes: 1 addition & 1 deletion pages/meta.es-ES.json → pages/_meta.es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "Introducción",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "Docs",
Expand Down
2 changes: 1 addition & 1 deletion pages/meta.ja.json → pages/_meta.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "前書き",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "ドキュメント",
Expand Down
2 changes: 1 addition & 1 deletion pages/meta.ko.json → pages/_meta.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "소개",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "문서",
Expand Down
2 changes: 1 addition & 1 deletion pages/meta.pt-BR.json → pages/_meta.pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "Introdução",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "Documentação",
Expand Down
2 changes: 1 addition & 1 deletion pages/meta.ru.json → pages/_meta.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "Введение",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "Документация",
Expand Down
4 changes: 2 additions & 2 deletions pages/meta.zh-CN.json → pages/_meta.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"index": {
"title": "简介",
"type": "page",
"hidden": true
"display": "hidden"
},
"docs": {
"title": "文档",
Expand All @@ -19,4 +19,4 @@
"sidebar": false
}
}
}
}
2 changes: 1 addition & 1 deletion pages/blog.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.es-ES.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.pt-BR.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR Blog</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.ru.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Блог
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">Блог SWR</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">Блог SWR</h1>

import BlogIndex from '../components/blog-index'

Expand Down
2 changes: 1 addition & 1 deletion pages/blog.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Blog
searchable: false
---

<h1 className="text-center font-extrabold md:text-5xl mt-8 pb-6">SWR 博客</h1>
<h1 className="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">SWR 博客</h1>

import BlogIndex from '../components/blog-index'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Almost 2 years ago we open sourced SWR, the tiny data-fetching Rea
date: August 27th, 2021
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.es-ES.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Almost 2 years ago we open sourced SWR, the tiny data-fetching Rea
date: August 27th, 2021
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'ほぼ二年前、みんなが愛する小さなデータフェッ
date: August 27th, 2021
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: '약 2년 전에 우리는 사람들이 사랑하는 조그만 데
date: 2021년 8월 27일
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.pt-BR.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Há quase 2 anos, abrimos o SWR para código aberto, a pequena bib
date: 27 de Agosto de 2021
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.ru.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Почти 2 года назад мы сделали SWR — кр
date: 27 августа 2021 г.
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v1.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: '大约两年前,我们开源了 SWR——广受大家喜爱的
date: August 27th, 2021
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'

Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v2.en-US.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Announcing SWR 2.0: new mutation APIs and improved optimistic UI c
date: December 9th, 2022
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'
import Video from 'components/video'
Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v2.es-ES.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Announcing SWR 2.0: new mutation APIs and improved optimistic UI c
date: December 9th, 2022
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'
import Video from 'components/video'
Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v2.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: '本日、SWR 2.0 のリリースを発表できることに興奮
date: December 9th, 2022
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'
import Video from 'components/video'
Expand Down
4 changes: 2 additions & 2 deletions pages/blog/swr-v2.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: 'Announcing SWR 2.0: new mutation APIs and improved optimistic UI c
date: December 9th, 2022
---

import Callout from 'nextra-theme-docs/callout'
import Bleed from 'nextra-theme-docs/bleed'
import { Callout } from 'nextra-theme-docs'
import { Bleed } from 'nextra-theme-docs'

import Authors, { Author } from 'components/authors'
import Video from 'components/video'
Expand Down
Loading