From 12e94ada1cd46f82e501e33ed63559e7c341ac6c Mon Sep 17 00:00:00 2001 From: endiliey Date: Fri, 25 Oct 2019 22:19:57 +0700 Subject: [PATCH 1/6] docs(v2): add docs on useful client api --- website/docs/docusaurus-core.md | 145 ++++++++++++++++++++++++++++++-- 1 file changed, 137 insertions(+), 8 deletions(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 21ffacd161ef..a89e9bd873b7 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -1,16 +1,145 @@ --- id: docusaurus-core -title: Docusaurus Core +title: Docusaurus API --- -_This section is a work in progress._ +Docusaurus provides some API on client that can be helpful when building your site. - +function Help() { + return ( +
+

Browse the docs

+

+ Learn more about Docusaurus using the{' '} + official documentation +

+
+ ); +} +``` From 053614a69f0f606c6b8e9ff55ea8edf10aff3a29 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Fri, 25 Oct 2019 08:36:32 -0700 Subject: [PATCH 2/6] Update docusaurus-core.md --- website/docs/docusaurus-core.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index a89e9bd873b7..1f4dd5a0dfbb 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -1,13 +1,13 @@ --- id: docusaurus-core -title: Docusaurus API +title: Docusaurus Core API --- Docusaurus provides some API on client that can be helpful when building your site. ## `` -This reusable React component will manage all of your changes to the document head. It takes plain HTML tags and outputs plain HTML tags. It's dead simple, and React beginner friendly. It is a wrapper of [React Helmet](https://github.com/nfl/react-helmet). +This reusable React component will manage all of your changes to the document head. It takes plain HTML tags and outputs plain HTML tags and is beginner-friendly. It is a wrapper around [React Helmet](https://github.com/nfl/react-helmet). Usage Example: @@ -27,7 +27,7 @@ const MySEO = () => ( ); ``` -Nested or latter components will override duplicate changes: +Nested or latter components will override duplicate usages: ```jsx @@ -56,9 +56,9 @@ Outputs ## `` -This component enables linking to internal pages as well as a powerful performance feature called preloading. Preloading is used to prefetch resources so that the resources are fetched by the time the user navigates with this component. We use an `IntersectionObserver` to fetch a low-priority request when the `Link` is in the viewport and then use an onMouseOver event to trigger a high-priority request when it is likely that a user will navigate to the requested resource. +This component enables linking to internal pages as well as a powerful performance feature called preloading. Preloading is used to prefetch resources so that the resources are fetched by the time the user navigates with this component. We use an `IntersectionObserver` to fetch a low-priority request when the `` is in the viewport and then use an `onMouseOver` event to trigger a high-priority request when it is likely that a user will navigate to the requested resource. -The component is a wrapper around react-router’s NavLink component that adds useful enhancements specific to Docusaurus. All props are passed through to react-router’s Link component. +The component is a wrapper around react-router’s `` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-router’s `` component. ```jsx import React from 'react'; @@ -77,17 +77,17 @@ const Page = () => ( ); ``` -### to: string +### `to`: string -A string representation of the Link location, created by concatenating the location's pathname, search, and hash properties. +A string representation of the `` location, created by concatenating the location's pathname, search, and hash properties. ```jsx ``` -### activeClassName: string +### `activeClassName`: string -The class to give the element when it is active. The default given class is `active`. This will be joined with the `className` prop. +The class to give the `` when it is active. The default given class is `active`. This will be joined with the `className` prop. ```jsx @@ -95,9 +95,9 @@ The class to give the element when it is active. The default given class is `act ``` -## useDocusaurusContext +## `useDocusaurusContext` -React Hooks to access Docusaurus Context. Context contains siteConfig object from [docusaurus.config.js](docusaurus.config.js.md). +React Hooks to access Docusaurus Context. Context contains `siteConfig` object from [docusaurus.config.js](docusaurus.config.js.md). ```ts interface DocusaurusContext { @@ -120,9 +120,9 @@ const Test = () => { }; ``` -## useBaseUrl +## `useBaseUrl` -React Hooks to automatically append [baseUrl] to a string automatically. +React Hooks to automatically append `baseUrl` to a string automatically. Example usage: From f4143915e8b43a0416fe7697611a45d8081194bf Mon Sep 17 00:00:00 2001 From: Endi Date: Fri, 25 Oct 2019 22:39:29 +0700 Subject: [PATCH 3/6] Update website/docs/docusaurus-core.md --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 1f4dd5a0dfbb..4d3fdb59742c 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -18,7 +18,7 @@ import Head from '@docusaurus/Head'; const MySEO = () => ( <> - + My Title From 3267b9019a48fde2800336c32f1fa5d6a8b570d8 Mon Sep 17 00:00:00 2001 From: Endi Date: Fri, 25 Oct 2019 22:39:53 +0700 Subject: [PATCH 4/6] Update website/docs/docusaurus-core.md --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 4d3fdb59742c..2c255447a580 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -58,7 +58,7 @@ Outputs This component enables linking to internal pages as well as a powerful performance feature called preloading. Preloading is used to prefetch resources so that the resources are fetched by the time the user navigates with this component. We use an `IntersectionObserver` to fetch a low-priority request when the `` is in the viewport and then use an `onMouseOver` event to trigger a high-priority request when it is likely that a user will navigate to the requested resource. -The component is a wrapper around react-router’s `` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-router’s `` component. +The component is a wrapper around react-router’s `` component that adds useful enhancements specific to Docusaurus. All props are passed through to react-router’s `` component. ```jsx import React from 'react'; From 4c58990ddb17dcb370886f26712b791de7145224 Mon Sep 17 00:00:00 2001 From: Endi Date: Fri, 25 Oct 2019 22:43:29 +0700 Subject: [PATCH 5/6] Update website/docs/docusaurus-core.md --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 2c255447a580..2bf1dd39015a 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -122,7 +122,7 @@ const Test = () => { ## `useBaseUrl` -React Hooks to automatically append `baseUrl` to a string automatically. +React Hook to automatically append `baseUrl` to a string automatically. This is particularly useful if you don't want to hardcode your baseUrl. Example usage: From f985f1009f3330adc380f9daaa4deade4ec15850 Mon Sep 17 00:00:00 2001 From: Endi Date: Fri, 25 Oct 2019 22:44:54 +0700 Subject: [PATCH 6/6] Update website/docs/docusaurus-core.md --- website/docs/docusaurus-core.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index 2bf1dd39015a..85e2501ee2af 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -79,7 +79,7 @@ const Page = () => ( ### `to`: string -A string representation of the `` location, created by concatenating the location's pathname, search, and hash properties. +The target location to navigate to. Example: `/docs/introduction`. ```jsx