-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(theme): apply docs
sidebar_class_name
in DocCard + better dogfo…
…oding (#10909)
- Loading branch information
Showing
11 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
website/_dogfooding/_docs tests/tests/custom-props/_category_.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
website/_dogfooding/_docs tests/tests/custom-props/doc-without-custom-props.mdx
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
website/_dogfooding/_docs tests/tests/custom-props/index.mdx
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...dogfooding/_docs tests/tests/sidebar-frontmatter/doc-with-sidebar-className.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sidebar_class_name: 'dogfood_sidebar_class_name_test' | ||
--- | ||
|
||
# Doc With Sidebar Class Name | ||
|
||
This doc has `sidebar_label` front matter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...te/_dogfooding/_docs tests/tests/sidebar-frontmatter/doc-with-sidebar-label.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sidebar_label: Doc With Sidebar Label | ||
--- | ||
|
||
# Doc with `sidebar_label` | ||
|
||
This doc has `sidebar_label` front matter |
3 changes: 3 additions & 0 deletions
3
website/_dogfooding/_docs tests/tests/sidebar-frontmatter/doc-without.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Doc Without | ||
|
||
This doc doesn't have any `sidebar_` front matter |
56 changes: 56 additions & 0 deletions
56
website/_dogfooding/_docs tests/tests/sidebar-frontmatter/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
sidebar_label: 'Sidebar Front Matter Tests' | ||
sidebar_class_name: 'dogfood_sidebar_class_name_test' | ||
--- | ||
|
||
# Sidebar front matter | ||
|
||
```mdx-code-block | ||
import Link from '@docusaurus/Link'; | ||
import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; | ||
import DocCardList from '@theme/DocCardList'; | ||
<DocCardList /> | ||
--- | ||
## Items table | ||
export const DocPropsList = ({category}) => { | ||
const items = [category, ...category.items]; | ||
return ( | ||
<table> | ||
<thead> | ||
<tr> | ||
<th> | ||
<code>type</code> | ||
</th> | ||
<th> | ||
<code>label</code> | ||
</th> | ||
<th> | ||
<code>customProps</code> | ||
</th> | ||
<th> | ||
<code>className</code> | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{items.map((item, index) => ( | ||
<tr key={index}> | ||
<td>{item.type}</td> | ||
<td> | ||
<Link to={item.href}>{item.label}</Link> | ||
</td> | ||
<td>{JSON.stringify(item.customProps)}</td> | ||
<td>{JSON.stringify(item.className)}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; | ||
<DocPropsList category={useCurrentSidebarCategory()} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters