create-trellis-docs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +29 -0
- package/lib/index.js +178 -0
- package/package.json +23 -0
- package/template/_gitignore +6 -0
- package/template/blog/2025-01-01-welcome.md +15 -0
- package/template/design-tokens.json +218 -0
- package/template/docs/faq/general.mdx +16 -0
- package/template/docs/faq/index.mdx +13 -0
- package/template/docs/getting-started.mdx +54 -0
- package/template/docs/guides/writing-docs.mdx +90 -0
- package/template/docusaurus.config.js.tpl +200 -0
- package/template/package.json.tpl +60 -0
- package/template/packages/faq-index-plugin/README.md +104 -0
- package/template/packages/faq-index-plugin/index.js +91 -0
- package/template/packages/faq-index-plugin/package.json +15 -0
- package/template/packages/redirects-plugin/README.md +186 -0
- package/template/packages/redirects-plugin/index.js +167 -0
- package/template/packages/redirects-plugin/package.json +15 -0
- package/template/packages/redirects-plugin/yarn.lock +31 -0
- package/template/redirects.json +1 -0
- package/template/scripts/build-tokens.js +34 -0
- package/template/sidebars.js +17 -0
- package/template/src/components/CustomSearch/CustomSearch.js +241 -0
- package/template/src/components/CustomSearch/CustomSearchContent.js +171 -0
- package/template/src/components/CustomSearch/NavbarSearch.js +211 -0
- package/template/src/components/CustomSearch/SearchContext.js +26 -0
- package/template/src/components/CustomSearch/styles.module.css +171 -0
- package/template/src/components/CustomSearch/wrapperInit.js +11 -0
- package/template/src/components/FaqTableOfContents/index.jsx +176 -0
- package/template/src/components/FaqTableOfContents/styles.module.css +167 -0
- package/template/src/components/Feedback/Feedback.js +310 -0
- package/template/src/components/Feedback/api.js +77 -0
- package/template/src/components/FlippingCard/FlippingCard.js +197 -0
- package/template/src/components/FlippingCard/styles.module.css +248 -0
- package/template/src/components/Glossary.js +57 -0
- package/template/src/css/custom.css +765 -0
- package/template/src/data/glossary.json +1 -0
- package/template/src/pages/index.js.tpl +38 -0
- package/template/src/theme/Admonition/Icon/Danger.js +11 -0
- package/template/src/theme/Admonition/Icon/Info.js +11 -0
- package/template/src/theme/Admonition/Icon/Note.js +11 -0
- package/template/src/theme/Admonition/Icon/Tip.js +11 -0
- package/template/src/theme/Admonition/Icon/Warning.js +11 -0
- package/template/src/theme/Admonition/Layout/index.js +39 -0
- package/template/src/theme/Admonition/Layout/styles.module.css +36 -0
- package/template/src/theme/Admonition/Type/Caution.js +28 -0
- package/template/src/theme/Admonition/Type/Danger.js +26 -0
- package/template/src/theme/Admonition/Type/Info.js +26 -0
- package/template/src/theme/Admonition/Type/Note.js +26 -0
- package/template/src/theme/Admonition/Type/Tip.js +26 -0
- package/template/src/theme/Admonition/Type/Warning.js +26 -0
- package/template/src/theme/Admonition/Types.js +27 -0
- package/template/src/theme/Admonition/index.js +18 -0
- package/template/src/theme/AnnouncementBar/CloseButton/index.js +20 -0
- package/template/src/theme/AnnouncementBar/CloseButton/styles.module.css +4 -0
- package/template/src/theme/AnnouncementBar/Content/index.js +17 -0
- package/template/src/theme/AnnouncementBar/Content/styles.module.css +10 -0
- package/template/src/theme/AnnouncementBar/index.js +33 -0
- package/template/src/theme/AnnouncementBar/styles.module.css +55 -0
- package/template/src/theme/BlogSidebar/Content/index.js +35 -0
- package/template/src/theme/BlogSidebar/Desktop/index.js +44 -0
- package/template/src/theme/BlogSidebar/Desktop/styles.module.css +60 -0
- package/template/src/theme/BlogSidebar/Mobile/index.js +38 -0
- package/template/src/theme/BlogSidebar/Mobile/styles.module.css +3 -0
- package/template/src/theme/BlogSidebar/index.js +15 -0
- package/template/src/theme/Details/index.js +23 -0
- package/template/src/theme/Details/styles.module.css +52 -0
- package/template/src/theme/DocBreadcrumbs/Items/Home/index.js +22 -0
- package/template/src/theme/DocBreadcrumbs/Items/Home/styles.module.css +7 -0
- package/template/src/theme/DocBreadcrumbs/StructuredData/index.js +15 -0
- package/template/src/theme/DocBreadcrumbs/index.js +75 -0
- package/template/src/theme/DocBreadcrumbs/styles.module.css +5 -0
- package/template/src/theme/DocCard/index.js +93 -0
- package/template/src/theme/DocCard/styles.module.css +53 -0
- package/template/src/theme/DocCardList/index.js +27 -0
- package/template/src/theme/DocCardList/styles.module.css +7 -0
- package/template/src/theme/DocItem/Content/index.js +121 -0
- package/template/src/theme/DocItem/Content/styles.module.css +96 -0
- package/template/src/theme/DocItem/Footer/index.js +43 -0
- package/template/src/theme/DocItem/Footer/styles.module.css +19 -0
- package/template/src/theme/DocItem/Layout/index.js +55 -0
- package/template/src/theme/DocItem/Layout/styles.module.css +14 -0
- package/template/src/theme/DocItem/Metadata/index.js +17 -0
- package/template/src/theme/DocItem/Paginator/index.js +17 -0
- package/template/src/theme/DocItem/TOC/Desktop/index.js +15 -0
- package/template/src/theme/DocItem/TOC/Mobile/index.js +17 -0
- package/template/src/theme/DocItem/TOC/Mobile/styles.module.css +12 -0
- package/template/src/theme/DocItem/index.js +19 -0
- package/template/src/theme/DocItem/styles.module.css +28 -0
- package/template/src/theme/DocRoot/Layout/Main/index.js +23 -0
- package/template/src/theme/DocRoot/Layout/Main/styles.module.css +31 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/ExpandButton/index.js +28 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/ExpandButton/styles.module.css +27 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/index.js +70 -0
- package/template/src/theme/DocRoot/Layout/Sidebar/styles.module.css +32 -0
- package/template/src/theme/DocRoot/Layout/index.js +27 -0
- package/template/src/theme/DocRoot/Layout/styles.module.css +9 -0
- package/template/src/theme/DocRoot/index.js +25 -0
- package/template/src/theme/DocSidebar/Desktop/CollapseButton/index.js +28 -0
- package/template/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +40 -0
- package/template/src/theme/DocSidebar/Desktop/Content/index.js +44 -0
- package/template/src/theme/DocSidebar/Desktop/Content/styles.module.css +16 -0
- package/template/src/theme/DocSidebar/Desktop/index.js +28 -0
- package/template/src/theme/DocSidebar/Desktop/styles.module.css +37 -0
- package/template/src/theme/DocSidebar/Mobile/index.js +39 -0
- package/template/src/theme/DocSidebar/index.js +18 -0
- package/template/src/theme/DocSidebarItem/Category/index.js +203 -0
- package/template/src/theme/DocSidebarItem/Html/index.js +20 -0
- package/template/src/theme/DocSidebarItem/Html/styles.module.css +6 -0
- package/template/src/theme/DocSidebarItem/Link/index.js +49 -0
- package/template/src/theme/DocSidebarItem/Link/styles.module.css +3 -0
- package/template/src/theme/DocSidebarItem/index.js +15 -0
- package/template/src/theme/EditMetaRow/index.js +25 -0
- package/template/src/theme/EditMetaRow/styles.module.css +11 -0
- package/template/src/theme/EditThisPage/index.js +29 -0
- package/template/src/theme/ErrorPageContent.js +34 -0
- package/template/src/theme/Footer/Copyright/index.js +11 -0
- package/template/src/theme/Footer/Layout/index.js +21 -0
- package/template/src/theme/Footer/LinkItem/index.js +26 -0
- package/template/src/theme/Footer/Links/MultiColumn/index.js +44 -0
- package/template/src/theme/Footer/Links/Simple/index.js +32 -0
- package/template/src/theme/Footer/Links/index.js +11 -0
- package/template/src/theme/Footer/Logo/index.js +35 -0
- package/template/src/theme/Footer/Logo/styles.module.css +9 -0
- package/template/src/theme/Footer/index.js +22 -0
- package/template/src/theme/MDXComponents/Heading.js +120 -0
- package/template/src/theme/MDXComponents/index.js +17 -0
- package/template/src/theme/MDXComponents/styles.module.css +110 -0
- package/template/src/theme/MDXContent/index.js +6 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Desktop/index.js +110 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Mobile/index.js +136 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/Mobile/styles.module.css +3 -0
- package/template/src/theme/NavbarItem/DropdownNavbarItem/index.js +7 -0
- package/template/src/theme/NotFound/Content/index.js +46 -0
- package/template/src/theme/NotFound/index.js +19 -0
- package/template/src/theme/NotFound.js +49 -0
- package/template/src/theme/PaginatorNavLink/index.js +17 -0
- package/template/src/theme/TOC/index.js +19 -0
- package/template/src/theme/TOC/styles.module.css +16 -0
- package/template/src/theme/TOCItems/Tree.js +30 -0
- package/template/src/theme/TOCItems/index.js +47 -0
- package/template/src/theme/TabItem/index.js +15 -0
- package/template/src/theme/TabItem/styles.module.css +10 -0
- package/template/src/theme/Tabs/index.js +189 -0
- package/template/src/theme/Tabs/styles.module.css +74 -0
- package/template/static/img/favicon.svg +4 -0
- package/template/static/img/oops-404.svg +11 -0
- package/template/static/searchIndex.json +1 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.sidebar {
|
|
2
|
+
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
|
|
3
|
+
overflow-y: auto;
|
|
4
|
+
overflow-x: hidden;
|
|
5
|
+
position: sticky;
|
|
6
|
+
top: calc(var(--ifm-navbar-height) + -1rem);
|
|
7
|
+
width: 100%;
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sidebarItemTitle {
|
|
12
|
+
font-size: var(--ifm-h3-font-size);
|
|
13
|
+
font-weight: var(--ifm-font-weight-bold);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sidebarItemList {
|
|
17
|
+
font-size: 0.9rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sidebarItem {
|
|
21
|
+
margin-top: 0.7rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.sidebarItemLink {
|
|
25
|
+
color: var(--ifm-font-color-base);
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sidebarItemLink:hover {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sidebarItemLinkActive {
|
|
34
|
+
color: var(--ifm-color-primary) !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (max-width: 996px) {
|
|
38
|
+
.sidebar {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (max-width: 1200px) {
|
|
44
|
+
.sidebar {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.yearGroupHeading {
|
|
50
|
+
margin-top: 1.6rem;
|
|
51
|
+
margin-bottom: 0.4rem;
|
|
52
|
+
font-size: 1.1rem;
|
|
53
|
+
font-weight: var(--ifm-font-weight-bold);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
.sidebarContainer {
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
min-width: 0;
|
|
60
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, {memo} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
useVisibleBlogSidebarItems,
|
|
4
|
+
BlogSidebarItemList,
|
|
5
|
+
} from '@docusaurus/plugin-content-blog/client';
|
|
6
|
+
import {NavbarSecondaryMenuFiller} from '@docusaurus/theme-common';
|
|
7
|
+
import BlogSidebarContent from '@theme/BlogSidebar/Content';
|
|
8
|
+
import styles from './styles.module.css';
|
|
9
|
+
const ListComponent = ({items}) => {
|
|
10
|
+
return (
|
|
11
|
+
<BlogSidebarItemList
|
|
12
|
+
items={items}
|
|
13
|
+
ulClassName="menu__list"
|
|
14
|
+
liClassName="menu__list-item"
|
|
15
|
+
linkClassName="menu__link"
|
|
16
|
+
linkActiveClassName="menu__link--active"
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
function BlogSidebarMobileSecondaryMenu({sidebar}) {
|
|
21
|
+
const items = useVisibleBlogSidebarItems(sidebar.items);
|
|
22
|
+
return (
|
|
23
|
+
<BlogSidebarContent
|
|
24
|
+
items={items}
|
|
25
|
+
ListComponent={ListComponent}
|
|
26
|
+
yearGroupHeadingClassName={styles.yearGroupHeading}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function BlogSidebarMobile(props) {
|
|
31
|
+
return (
|
|
32
|
+
<NavbarSecondaryMenuFiller
|
|
33
|
+
component={BlogSidebarMobileSecondaryMenu}
|
|
34
|
+
props={props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export default memo(BlogSidebarMobile);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {useWindowSize} from '@docusaurus/theme-common';
|
|
3
|
+
import BlogSidebarDesktop from '@theme/BlogSidebar/Desktop';
|
|
4
|
+
import BlogSidebarMobile from '@theme/BlogSidebar/Mobile';
|
|
5
|
+
export default function BlogSidebar({sidebar}) {
|
|
6
|
+
const windowSize = useWindowSize();
|
|
7
|
+
if (!sidebar?.items.length) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
// Mobile sidebar doesn't need to be server-rendered
|
|
11
|
+
if (windowSize === 'mobile') {
|
|
12
|
+
return <BlogSidebarMobile sidebar={sidebar} />;
|
|
13
|
+
}
|
|
14
|
+
return <BlogSidebarDesktop sidebar={sidebar} />;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Details as DetailsGeneric } from '@docusaurus/theme-common/Details';
|
|
4
|
+
import styles from './styles.module.css';
|
|
5
|
+
|
|
6
|
+
const InfimaClasses = 'alert alert--info';
|
|
7
|
+
|
|
8
|
+
export default function Details({ ...props }) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.padding}>
|
|
11
|
+
<DetailsGeneric
|
|
12
|
+
{...props}
|
|
13
|
+
className={clsx(
|
|
14
|
+
InfimaClasses,
|
|
15
|
+
styles.details,
|
|
16
|
+
styles.detailsContainer,
|
|
17
|
+
styles.summaryHeading,
|
|
18
|
+
props.className
|
|
19
|
+
)}
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* styles.module.css */
|
|
2
|
+
|
|
3
|
+
/* Define variables for light mode */
|
|
4
|
+
:root {
|
|
5
|
+
--details-bg-color: #F6F8FA;
|
|
6
|
+
--details-border-color: #3856A616;
|
|
7
|
+
--details-text-color: #333333;
|
|
8
|
+
--details-link-color: var(--brand-primary-600-value);
|
|
9
|
+
--details-padding: 16px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Define variables for dark mode */
|
|
13
|
+
[data-theme='dark'] {
|
|
14
|
+
--details-bg-color: #2E2E2E;
|
|
15
|
+
--details-border-color: #565656;
|
|
16
|
+
--details-text-color: #DDDDDD;
|
|
17
|
+
--details-link-color: var(--accent-teal-400-value);
|
|
18
|
+
--details-padding: 16px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.padding {
|
|
22
|
+
padding: 0 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* details */
|
|
26
|
+
.details {
|
|
27
|
+
--docusaurus-details-decoration-color: var(--details-link-color);
|
|
28
|
+
--docusaurus-details-transition: transform var(--ifm-transition-fast) ease;
|
|
29
|
+
margin: 0 0 var(--ifm-spacing-vertical);
|
|
30
|
+
border: 0.01px solid var(--details-border-color);
|
|
31
|
+
color: var(--details-text-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.detailsContainer {
|
|
35
|
+
background-color: var(--details-bg-color);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.detailsContainer a {
|
|
41
|
+
color: var(--details-link-color);
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* summary */
|
|
46
|
+
.summaryHeading {
|
|
47
|
+
font-size: 17px;
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
margin-top: 1.5rem;
|
|
50
|
+
vertical-align: bottom;
|
|
51
|
+
}
|
|
52
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
4
|
+
import {translate} from '@docusaurus/Translate';
|
|
5
|
+
|
|
6
|
+
export default function HomeBreadcrumbItem() {
|
|
7
|
+
const homeHref = useBaseUrl('/');
|
|
8
|
+
return (
|
|
9
|
+
<li className="breadcrumbs__item">
|
|
10
|
+
<Link
|
|
11
|
+
aria-label={translate({
|
|
12
|
+
id: 'theme.docs.breadcrumbs.home',
|
|
13
|
+
message: 'Home page',
|
|
14
|
+
description: 'The ARIA label for the home page in the breadcrumbs',
|
|
15
|
+
})}
|
|
16
|
+
className="breadcrumbs__link"
|
|
17
|
+
href={homeHref}>Home
|
|
18
|
+
|
|
19
|
+
</Link>
|
|
20
|
+
</li>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Head from '@docusaurus/Head';
|
|
3
|
+
import {useBreadcrumbsStructuredData} from '@docusaurus/plugin-content-docs/client';
|
|
4
|
+
export default function DocBreadcrumbsStructuredData(props) {
|
|
5
|
+
const structuredData = useBreadcrumbsStructuredData({
|
|
6
|
+
breadcrumbs: props.breadcrumbs,
|
|
7
|
+
});
|
|
8
|
+
return (
|
|
9
|
+
<Head>
|
|
10
|
+
<script type="application/ld+json">
|
|
11
|
+
{JSON.stringify(structuredData)}
|
|
12
|
+
</script>
|
|
13
|
+
</Head>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import {useSidebarBreadcrumbs} from '@docusaurus/plugin-content-docs/client';
|
|
5
|
+
import {useHomePageRoute} from '@docusaurus/theme-common/internal';
|
|
6
|
+
import Link from '@docusaurus/Link';
|
|
7
|
+
import {translate} from '@docusaurus/Translate';
|
|
8
|
+
import HomeBreadcrumbItem from '@theme/DocBreadcrumbs/Items/Home';
|
|
9
|
+
import DocBreadcrumbsStructuredData from '@theme/DocBreadcrumbs/StructuredData';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
// TODO move to design system folder
|
|
12
|
+
function BreadcrumbsItemLink({children, href, isLast}) {
|
|
13
|
+
const className = 'breadcrumbs__link';
|
|
14
|
+
if (isLast) {
|
|
15
|
+
return <span className={className}>{children}</span>;
|
|
16
|
+
}
|
|
17
|
+
return href ? (
|
|
18
|
+
<Link className={className} href={href}>
|
|
19
|
+
<span>{children}</span>
|
|
20
|
+
</Link>
|
|
21
|
+
) : (
|
|
22
|
+
<span className={className}>{children}</span>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
// TODO move to design system folder
|
|
26
|
+
function BreadcrumbsItem({children, active}) {
|
|
27
|
+
return (
|
|
28
|
+
<li
|
|
29
|
+
className={clsx('breadcrumbs__item', {
|
|
30
|
+
'breadcrumbs__item--active': active,
|
|
31
|
+
})}>
|
|
32
|
+
{children}
|
|
33
|
+
</li>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
export default function DocBreadcrumbs() {
|
|
37
|
+
const breadcrumbs = useSidebarBreadcrumbs();
|
|
38
|
+
const homePageRoute = useHomePageRoute();
|
|
39
|
+
if (!breadcrumbs) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<DocBreadcrumbsStructuredData breadcrumbs={breadcrumbs} />
|
|
45
|
+
<nav
|
|
46
|
+
className={clsx(
|
|
47
|
+
ThemeClassNames.docs.docBreadcrumbs,
|
|
48
|
+
styles.breadcrumbsContainer,
|
|
49
|
+
)}
|
|
50
|
+
aria-label={translate({
|
|
51
|
+
id: 'theme.docs.breadcrumbs.navAriaLabel',
|
|
52
|
+
message: 'Breadcrumbs',
|
|
53
|
+
description: 'The ARIA label for the breadcrumbs',
|
|
54
|
+
})}>
|
|
55
|
+
<ul className="breadcrumbs">
|
|
56
|
+
{homePageRoute && <HomeBreadcrumbItem />}
|
|
57
|
+
{breadcrumbs.map((item, idx) => {
|
|
58
|
+
const isLast = idx === breadcrumbs.length - 1;
|
|
59
|
+
const href =
|
|
60
|
+
item.type === 'category' && item.linkUnlisted
|
|
61
|
+
? undefined
|
|
62
|
+
: item.href;
|
|
63
|
+
return (
|
|
64
|
+
<BreadcrumbsItem key={idx} active={isLast}>
|
|
65
|
+
<BreadcrumbsItemLink href={href} isLast={isLast}>
|
|
66
|
+
{item.label}
|
|
67
|
+
</BreadcrumbsItemLink>
|
|
68
|
+
</BreadcrumbsItem>
|
|
69
|
+
);
|
|
70
|
+
})}
|
|
71
|
+
</ul>
|
|
72
|
+
</nav>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import Link from '@docusaurus/Link';
|
|
4
|
+
import {
|
|
5
|
+
useDocById,
|
|
6
|
+
findFirstSidebarItemLink,
|
|
7
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
8
|
+
import {usePluralForm} from '@docusaurus/theme-common';
|
|
9
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
10
|
+
import {translate} from '@docusaurus/Translate';
|
|
11
|
+
import Heading from '@theme/Heading';
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
|
+
function useCategoryItemsPlural() {
|
|
14
|
+
const {selectMessage} = usePluralForm();
|
|
15
|
+
return (count) =>
|
|
16
|
+
selectMessage(
|
|
17
|
+
count,
|
|
18
|
+
translate(
|
|
19
|
+
{
|
|
20
|
+
message: '1 item|{count} items',
|
|
21
|
+
id: 'theme.docs.DocCard.categoryDescription.plurals',
|
|
22
|
+
description:
|
|
23
|
+
'The default description for a category card in the generated index about how many items this category includes',
|
|
24
|
+
},
|
|
25
|
+
{count},
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function CardContainer({className, href, children}) {
|
|
30
|
+
return (
|
|
31
|
+
<Link
|
|
32
|
+
href={href}
|
|
33
|
+
className={clsx('card', styles.cardContainer)}>
|
|
34
|
+
{children}
|
|
35
|
+
</Link>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function CardLayout({className, href, title, description}) {
|
|
39
|
+
return (
|
|
40
|
+
<CardContainer href={href}>
|
|
41
|
+
<h3 className={clsx(styles.cardTitle)} title={title}>
|
|
42
|
+
{title}
|
|
43
|
+
</h3>
|
|
44
|
+
{description && (
|
|
45
|
+
<p
|
|
46
|
+
className={clsx(styles.cardDescription)}
|
|
47
|
+
title={description}>
|
|
48
|
+
{description}
|
|
49
|
+
</p>
|
|
50
|
+
)}
|
|
51
|
+
</CardContainer>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function CardCategory({item}) {
|
|
55
|
+
const href = findFirstSidebarItemLink(item);
|
|
56
|
+
const categoryItemsPlural = useCategoryItemsPlural();
|
|
57
|
+
// Unexpected: categories that don't have a link have been filtered upfront
|
|
58
|
+
if (!href) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<CardLayout
|
|
63
|
+
className={item.className}
|
|
64
|
+
href={href}
|
|
65
|
+
icon="🗃️"
|
|
66
|
+
title={item.label}
|
|
67
|
+
description={item.description ?? categoryItemsPlural(item.items.length)}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function CardLink({item}) {
|
|
72
|
+
const icon = isInternalUrl(item.href) ? '📄️' : '🔗';
|
|
73
|
+
const doc = useDocById(item.docId ?? undefined);
|
|
74
|
+
return (
|
|
75
|
+
<CardLayout
|
|
76
|
+
className={item.className}
|
|
77
|
+
href={item.href}
|
|
78
|
+
icon={icon}
|
|
79
|
+
title={item.label}
|
|
80
|
+
description={item.description ?? doc?.description}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
export default function DocCard({item}) {
|
|
85
|
+
switch (item.type) {
|
|
86
|
+
case 'link':
|
|
87
|
+
return <CardLink item={item} />;
|
|
88
|
+
case 'category':
|
|
89
|
+
return <CardCategory item={item} />;
|
|
90
|
+
default:
|
|
91
|
+
throw new Error(`unknown item type ${JSON.stringify(item)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.cardContainer {
|
|
2
|
+
--ifm-link-color: var(--ifm-color-emphasis-800);
|
|
3
|
+
--ifm-link-hover-color: var(--ifm-color-emphasis-700);
|
|
4
|
+
--ifm-link-hover-decoration: none;
|
|
5
|
+
|
|
6
|
+
box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%);
|
|
7
|
+
border: 0px solid var(--ifm-color-emphasis-200);
|
|
8
|
+
transition: all var(--ifm-transition-fast) ease;
|
|
9
|
+
transition-property: border, box-shadow;
|
|
10
|
+
|
|
11
|
+
padding: 0 20px 20px 20px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.cardContainer p {
|
|
15
|
+
font-size: 0.88rem;
|
|
16
|
+
font-stretch: semi-condensed;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cardContainer h3 {
|
|
20
|
+
font-size: 22px;
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-theme='dark'] .cardContainer {
|
|
25
|
+
background-color: var(--ifm-background-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.cardContainer:hover {
|
|
29
|
+
border-color: var(--ifm-color-primary);
|
|
30
|
+
box-shadow: 0 3px 6px 0 rgb(0 0 0 / 20%);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.cardContainer *:last-child {
|
|
34
|
+
margin-bottom: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.cardTitle {
|
|
38
|
+
color: var(--ifm-color-primary);
|
|
39
|
+
padding: 20px 0 0 0;
|
|
40
|
+
font-size: 1.2rem;
|
|
41
|
+
margin-bottom: 0px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
.cardDescription {
|
|
46
|
+
font-size: 0.75rem;
|
|
47
|
+
color: #333;
|
|
48
|
+
font-stretch: semi-condensed;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-theme='dark'] .cardDescription {
|
|
52
|
+
color: white;
|
|
53
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
useCurrentSidebarCategory,
|
|
5
|
+
filterDocCardListItems,
|
|
6
|
+
} from '@docusaurus/theme-common';
|
|
7
|
+
import DocCard from '@theme/DocCard';
|
|
8
|
+
function DocCardListForCurrentSidebarCategory({className}) {
|
|
9
|
+
const category = useCurrentSidebarCategory();
|
|
10
|
+
return <DocCardList items={category.items} className={className} />;
|
|
11
|
+
}
|
|
12
|
+
export default function DocCardList(props) {
|
|
13
|
+
const {items, className} = props;
|
|
14
|
+
if (!items) {
|
|
15
|
+
return <DocCardListForCurrentSidebarCategory {...props} />;
|
|
16
|
+
}
|
|
17
|
+
const filteredItems = filterDocCardListItems(items);
|
|
18
|
+
return (
|
|
19
|
+
<section className={clsx('row', className)}>
|
|
20
|
+
{filteredItems.map((item, index) => (
|
|
21
|
+
<article key={index} className="col col--6 margin-bottom--md margin-top--sm">
|
|
22
|
+
<DocCard item={item} />
|
|
23
|
+
</article>
|
|
24
|
+
))}
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
4
|
+
import {useDoc} from '@docusaurus/plugin-content-docs/client';
|
|
5
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
|
+
import Heading from '@theme/Heading';
|
|
7
|
+
import MDXContent from '@theme/MDXContent';
|
|
8
|
+
import Translate from '@docusaurus/Translate';
|
|
9
|
+
import LastUpdated from '@theme/LastUpdated';
|
|
10
|
+
import IconEdit from '@theme/Icon/Edit';
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
|
|
13
|
+
function useSyntheticTitle() {
|
|
14
|
+
const { metadata, frontMatter, contentTitle } = useDoc();
|
|
15
|
+
const shouldRender = !frontMatter.hide_title && typeof contentTitle === 'undefined';
|
|
16
|
+
return shouldRender ? metadata.title : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Component for the "Edit This Page" link
|
|
20
|
+
function EditThisPage({ editUrl }) {
|
|
21
|
+
return (
|
|
22
|
+
<a
|
|
23
|
+
href={editUrl}
|
|
24
|
+
target="_blank"
|
|
25
|
+
rel="noreferrer noopener"
|
|
26
|
+
className={ThemeClassNames.common.editThisPage}
|
|
27
|
+
>
|
|
28
|
+
<IconEdit />
|
|
29
|
+
<Translate
|
|
30
|
+
id="theme.common.editThisPage"
|
|
31
|
+
description="The link label to edit the current page"
|
|
32
|
+
>
|
|
33
|
+
Edit this page
|
|
34
|
+
</Translate>
|
|
35
|
+
</a>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Component for the "Suggest an Edit" link
|
|
40
|
+
function SuggestEdit() {
|
|
41
|
+
const { metadata } = useDoc();
|
|
42
|
+
const { siteConfig } = useDocusaurusContext();
|
|
43
|
+
const repoUrl = siteConfig.customFields?.repoUrl || '';
|
|
44
|
+
if (!repoUrl) return null;
|
|
45
|
+
const issueURL = `${repoUrl}/issues/new?title=${encodeURIComponent(metadata.title)}&body=${encodeURIComponent(`Issue with: ${metadata.permalink}`)}`;
|
|
46
|
+
return (
|
|
47
|
+
<a
|
|
48
|
+
href={issueURL}
|
|
49
|
+
target="_blank"
|
|
50
|
+
rel="noreferrer noopener"
|
|
51
|
+
className={ThemeClassNames.common.editThisPage}
|
|
52
|
+
>
|
|
53
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="currentColor" style={{ marginRight: 6 }}>
|
|
54
|
+
<path d="M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9v1zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7z"/>
|
|
55
|
+
</svg>
|
|
56
|
+
<Translate
|
|
57
|
+
id="theme.common.openDocIssue"
|
|
58
|
+
description="The link label to open a doc issue on the current page"
|
|
59
|
+
>
|
|
60
|
+
Suggest an Edit
|
|
61
|
+
</Translate>
|
|
62
|
+
</a>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Component to display the last updated date and edit links
|
|
67
|
+
function LastUpdatedRow({ lastUpdatedAt, formattedLastUpdatedAt, editUrl }) {
|
|
68
|
+
return (
|
|
69
|
+
<div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, styles.row)}>
|
|
70
|
+
<div className={clsx(styles.lastUpdated)}>
|
|
71
|
+
{lastUpdatedAt && (
|
|
72
|
+
<LastUpdated
|
|
73
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
74
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
<div className={clsx(styles.editThisPage)}>
|
|
79
|
+
<SuggestEdit />
|
|
80
|
+
|
|
|
81
|
+
{editUrl && <EditThisPage editUrl={editUrl} />}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Main header component to display the last updated date and edit links
|
|
88
|
+
function DocItemHeader() {
|
|
89
|
+
const { metadata } = useDoc();
|
|
90
|
+
const { lastUpdatedAt, formattedLastUpdatedAt, editUrl } = metadata;
|
|
91
|
+
const canDisplayLastUpdatedRow = !!lastUpdatedAt || !!editUrl;
|
|
92
|
+
|
|
93
|
+
if (!canDisplayLastUpdatedRow) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div className={clsx(ThemeClassNames.docs.docFooter, 'docusaurus-mt-lg')}>
|
|
99
|
+
<LastUpdatedRow
|
|
100
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
101
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
102
|
+
editUrl={editUrl}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default function DocItemContent({children}) {
|
|
109
|
+
const syntheticTitle = useSyntheticTitle();
|
|
110
|
+
return (
|
|
111
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
112
|
+
{syntheticTitle && (
|
|
113
|
+
<header>
|
|
114
|
+
<Heading as="h1">{syntheticTitle}</Heading>
|
|
115
|
+
<DocItemHeader />
|
|
116
|
+
</header>
|
|
117
|
+
)}
|
|
118
|
+
<MDXContent>{children}</MDXContent>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|