chore: update examples for v3.0.0 (#9482)

This commit is contained in:
Sébastien Lorber 2023-10-31 22:53:06 +01:00 committed by GitHub
parent 5d2f9cf70a
commit ef70ba493a
11 changed files with 2540 additions and 1697 deletions

View file

@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
### What you'll need ### What you'll need
- [Node.js](https://nodejs.org/en/download/) version 16.14 or above: - [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies. - When installing Node.js, you are recommended to check all checkboxes related to dependencies.
## Generate a new site ## Generate a new site

View file

@ -42,7 +42,7 @@ This is my **first Docusaurus document**!
It is also possible to create your sidebar explicitly in `sidebars.js`: It is also possible to create your sidebar explicitly in `sidebars.js`:
```js title="sidebars.js" ```js title="sidebars.js"
module.exports = { export default {
tutorialSidebar: [ tutorialSidebar: [
'intro', 'intro',
// highlight-next-line // highlight-next-line

View file

@ -28,7 +28,7 @@ To navigate seamlessly across versions, add a version dropdown.
Modify the `docusaurus.config.js` file: Modify the `docusaurus.config.js` file:
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { export default {
themeConfig: { themeConfig: {
navbar: { navbar: {
items: [ items: [

View file

@ -11,7 +11,7 @@ Let's translate `docs/intro.md` to French.
Modify `docusaurus.config.js` to add support for the `fr` locale: Modify `docusaurus.config.js` to add support for the `fr` locale:
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { export default {
i18n: { i18n: {
defaultLocale: 'en', defaultLocale: 'en',
locales: ['en', 'fr'], locales: ['en', 'fr'],
@ -43,7 +43,7 @@ Your localized site is accessible at [http://localhost:3000/fr/](http://localhos
:::caution :::caution
In development, you can only use one locale at a same time. In development, you can only use one locale at a time.
::: :::
@ -54,7 +54,7 @@ To navigate seamlessly across languages, add a locale dropdown.
Modify the `docusaurus.config.js` file: Modify the `docusaurus.config.js` file:
```js title="docusaurus.config.js" ```js title="docusaurus.config.js"
module.exports = { export default {
themeConfig: { themeConfig: {
navbar: { navbar: {
items: [ items: [

View file

@ -1,8 +1,10 @@
// @ts-check // @ts-check
// Note: type annotations allow type checking and IDEs autocompletion // `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
const lightCodeTheme = require('prism-react-renderer/themes/github'); import {themes as prismThemes} from 'prism-react-renderer';
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */ /** @type {import('@docusaurus/types').Config} */
const config = { const config = {
@ -11,7 +13,7 @@ const config = {
favicon: 'img/favicon.ico', favicon: 'img/favicon.ico',
// Set the production url of your site here // Set the production url of your site here
url: 'https://your-docusaurus-test-site.com', url: 'https://your-docusaurus-site.example.com',
// Set the /<baseUrl>/ pathname under which your site is served // Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/' // For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/', baseUrl: '/',
@ -24,9 +26,9 @@ const config = {
onBrokenLinks: 'throw', onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn', onBrokenMarkdownLinks: 'warn',
// Even if you don't use internalization, you can use this field to set useful // Even if you don't use internationalization, you can use this field to set
// metadata like html lang. For example, if your site is Chinese, you may want // useful metadata like html lang. For example, if your site is Chinese, you
// to replace "en" with "zh-Hans". // may want to replace "en" with "zh-Hans".
i18n: { i18n: {
defaultLocale: 'en', defaultLocale: 'en',
locales: ['en'], locales: ['en'],
@ -38,7 +40,7 @@ const config = {
/** @type {import('@docusaurus/preset-classic').Options} */ /** @type {import('@docusaurus/preset-classic').Options} */
({ ({
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: './sidebars.js',
// Please change this to your repo. // Please change this to your repo.
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
editUrl: editUrl:
@ -52,7 +54,7 @@ const config = {
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
}, },
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: './src/css/custom.css',
}, },
}), }),
], ],
@ -130,10 +132,10 @@ const config = {
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
}, },
prism: { prism: {
theme: lightCodeTheme, theme: prismThemes.github,
darkTheme: darkCodeTheme, darkTheme: prismThemes.dracula,
}, },
}), }),
}; };
module.exports = config; export default config;

View file

@ -15,16 +15,17 @@
"dev": "docusaurus start" "dev": "docusaurus start"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "2.4.3", "@docusaurus/core": "3.0.0",
"@docusaurus/preset-classic": "2.4.3", "@docusaurus/preset-classic": "3.0.0",
"@mdx-js/react": "^1.6.22", "@mdx-js/react": "^3.0.0",
"clsx": "^1.2.1", "clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5", "prism-react-renderer": "^2.1.0",
"react": "^17.0.2", "react": "^18.0.0",
"react-dom": "^17.0.2" "react-dom": "^18.0.0"
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "2.4.3" "@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/types": "3.0.0"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
@ -33,13 +34,13 @@
"not op_mini all" "not op_mini all"
], ],
"development": [ "development": [
"last 1 chrome version", "last 3 chrome version",
"last 1 firefox version", "last 3 firefox version",
"last 1 safari version" "last 5 safari version"
] ]
}, },
"engines": { "engines": {
"node": ">=16.14" "node": ">=18.0"
}, },
"description": "Docusaurus example project" "description": "Docusaurus example project"
} }

View file

@ -3,8 +3,8 @@
"hardReloadOnChange": true, "hardReloadOnChange": true,
"view": "browser", "view": "browser",
"template": "docusaurus", "template": "docusaurus",
"node": "16", "node": "18",
"container": { "container": {
"node": "16" "node": "18"
} }
} }

View file

@ -30,4 +30,4 @@ const sidebars = {
*/ */
}; };
module.exports = sidebars; export default sidebars;

View file

@ -1,5 +1,5 @@
import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
import Heading from '@theme/Heading';
import styles from './styles.module.css'; import styles from './styles.module.css';
const FeatureList = [ const FeatureList = [
@ -42,7 +42,7 @@ function Feature({Svg, title, description}) {
<Svg className={styles.featureSvg} role="img" /> <Svg className={styles.featureSvg} role="img" />
</div> </div>
<div className="text--center padding-horiz--md"> <div className="text--center padding-horiz--md">
<h3>{title}</h3> <Heading as="h3">{title}</Heading>
<p>{description}</p> <p>{description}</p>
</div> </div>
</div> </div>

View file

@ -1,10 +1,10 @@
import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout'; import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures'; import HomepageFeatures from '@site/src/components/HomepageFeatures';
import Heading from '@theme/Heading';
import styles from './index.module.css'; import styles from './index.module.css';
function HomepageHeader() { function HomepageHeader() {
@ -12,7 +12,9 @@ function HomepageHeader() {
return ( return (
<header className={clsx('hero hero--primary', styles.heroBanner)}> <header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container"> <div className="container">
<h1 className="hero__title">{siteConfig.title}</h1> <Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">{siteConfig.tagline}</p> <p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}> <div className={styles.buttons}>
<Link <Link

4160
yarn.lock

File diff suppressed because it is too large Load diff