mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
docs: change sidebar behavior
[DOCS-967]: https://hasurahq.atlassian.net/browse/DOCS-967?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9179 GitOrigin-RevId: f99e342f6ca2602304c8f35b016b2d63c93340b0
This commit is contained in:
parent
c0e998400b
commit
962e176258
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "Authentication & Authorization",
|
||||
"position": 70
|
||||
}
|
||||
"position": 70,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "auth"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "GraphQL Federation",
|
||||
"position": 100
|
||||
"position": 100,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "data-federation"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
{
|
||||
"label": "Hasura Enterprise",
|
||||
"position": 210,
|
||||
"className": "enterprise-icon"
|
||||
"className": "enterprise-icon",
|
||||
"customProps": {
|
||||
"sidebar_pathname": "enterprise"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "Migrations, Metadata and Seeds",
|
||||
"position": 140
|
||||
"position": 140,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "migrations-metadata-seeds"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "Hasura Policies",
|
||||
"position": 220
|
||||
"position": 220,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "policies"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "Hasura Use Cases",
|
||||
"position": 1
|
||||
"position": 1,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "resources/use-case"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "RESTified Endpoints",
|
||||
"position": 125
|
||||
"position": 125,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "restified"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "GraphQL Schema",
|
||||
"position": 30
|
||||
"position": 30,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "schema"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"label": "Security Tools",
|
||||
"position": 160
|
||||
"position": 160,
|
||||
"customProps": {
|
||||
"sidebar_pathname": "security"
|
||||
}
|
||||
}
|
||||
|
29
docs/src/theme/DocSidebarItem/index.js
Normal file
29
docs/src/theme/DocSidebarItem/index.js
Normal file
@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import DocSidebarItemCategory from '@theme/DocSidebarItem/Category';
|
||||
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
|
||||
import DocSidebarItemHtml from '@theme/DocSidebarItem/Html';
|
||||
|
||||
export default function DocSidebarItem({ item, ...props }) {
|
||||
switch (item.type) {
|
||||
case 'category':
|
||||
if (item.customProps?.sidebar_pathname) {
|
||||
// if there is a custom sidebar_pathname, use it
|
||||
item.href = `/docs/latest/${item.customProps.sidebar_pathname}/overview/`;
|
||||
} else if (item.href === undefined) {
|
||||
// if there is no custom sidebar_pathname, use the label with our regex
|
||||
// and apparently deal with the Wiki as a special case
|
||||
if (item.label != 'Docs Wiki') {
|
||||
item.href = `/docs/latest/${item.label.toLowerCase().replace(/\s/g, '-')}/overview/`;
|
||||
}
|
||||
} else {
|
||||
// if it already has a href (such as any category that has an index within the dir), use it
|
||||
item.href = item.href;
|
||||
}
|
||||
return <DocSidebarItemCategory item={item} {...props} />;
|
||||
case 'html':
|
||||
return <DocSidebarItemHtml item={item} {...props} />;
|
||||
case 'link':
|
||||
default:
|
||||
return <DocSidebarItemLink item={item} {...props} />;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user