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

Convert to nextra 3 #1487

Merged
merged 12 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ npx cspell --help

Upload images/GIFs to the public/ directory. You can make sub-directories within `public/` to namespace them (eg: `/public/tutorials/` for all tutorial-related images).

To reference an image, use a relative link to the image with the `public` stripped out. For example, if you have an image `public/example.png`, you can reference it as follows: `[insert alt text here](/example.png)`.
To reference an image, use a relative link to the image with the `public` stripped out. For example, if you have an image `public/example.png`, you can reference it as follows: `[insert alt text here](/example.png)`. Ensure that the the image filename has no spaces and are separated by either a hyphen or an underscore.

If you're making a diagram, please add it to this [Figjam](https://www.figma.com/file/m4XseN6oAiu2yGN18qfamD/Docs-Toolkit?type=whiteboard&node-id=0-1&t=j3TBgane3MsYReF2-0). That way, if others want to make small tweaks, they can discover the original.

Expand All @@ -73,6 +73,9 @@ All pull requests will generate a staging link in Vercel. Here's an [example](ht

You may also preview changes by [testing locally](#testing-locally)

# Nextra 3.0
We are now using [Nextra 3](https://the-guild.dev/blog/nextra-3), which is slightly different than Nextra 2. The main differences for most maintainers is that instead of _meta.json to generate custom sidebars, it is now in Javascript or Typescript, and can be rendered with components. Another difference is that `Tab` is now imported from `Tabs.Tab` and `Card` from `Cards.Card`, both from `nextra/components`.

# Changelog

We make a changelog post for every feature we ship. It usually includes a Loom link + a description of the feature. Make sure to include either `video: <loom link>` or `thumbnail: <image>` to ensure that we have a preview video or image for every changelog post.
Expand All @@ -81,9 +84,9 @@ We make a changelog post for every feature we ship. It usually includes a Loom l

# Maintainers

[Vijay](https://github.com/ranic), [Marissa](https://github.com/marissakuhrau), [Mav](https://github.com/mavlee), [Isha](https://github.com/ishamehramixpanel). Eventually we’ll expand this list, but keeping it tight for now.
[Marissa](https://github.com/marissakuhrau), [Mav](https://github.com/mavlee), [Isha](https://github.com/ishamehramixpanel), and [Myron](https://github.com/myronkaifung). Eventually we’ll expand this list, but keeping it tight for now.

## Review Process
# Review Process

For simple content changes, the reviewer will merge the PR for expediency. For code changes, the original author will merge changes.

Expand Down
2 changes: 1 addition & 1 deletion components/ExtendedTabs/ExtendedTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tabs } from 'nextra-theme-docs'
import { Tabs } from 'nextra/components'
import { useEffect, useState } from 'react';

type ExtendedTabsType = {
Expand Down
3 changes: 2 additions & 1 deletion components/changelog-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const renderMedia = (page) => {
};

export default function ChangelogIndex({ more = "Read more" }) {
const allPages = getPagesUnderRoute("/changelogs");
// naturally sorts pages from a-z rather than z-a
const allPages = getPagesUnderRoute("/changelogs").reverse();
const itemsPerPage = 10;
const [displayedPages, setDisplayedPages] = useState([]);
const [pageIndex, setPageIndex] = useState(0);
Expand Down
14 changes: 10 additions & 4 deletions next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
const fs = require("fs");
const { join } = require("path");
import fs from "fs";
import { fileURLToPath } from "url";
import { join, dirname } from "path";
import nextra from "nextra";

const withNextra = require("nextra")({
// Get __dirname equivalent in ES modules
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const withNextra = nextra({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
staticImage: true,
Expand Down Expand Up @@ -50,7 +56,7 @@ function formatForNextRedirect({ source, destination }) {
return { source, destination, permanent: true };
}

module.exports = withNextra({
export default withNextra({
redirects: () => {
return fs.readdirSync(join(__dirname, "redirects")).flatMap((filename) => {
const pathToFile = join(__dirname, "redirects", filename);
Expand Down
Loading