@docusaurus/theme-classic 0.0.0-4240 → 0.0.0-4241
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/lib/theme/DocCard/index.js +84 -0
- package/lib/theme/DocCard/styles.module.css +43 -0
- package/lib/theme/DocCardList/index.js +28 -0
- package/lib/theme/DocCategoryGeneratedIndexPage/index.js +57 -0
- package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/lib/theme/DocItem/index.js +6 -7
- package/lib/theme/DocPage/index.js +16 -9
- package/lib/theme/DocPaginator/index.js +6 -7
- package/lib/theme/DocSidebar/index.js +10 -1
- package/lib/theme/DocSidebarItem/index.js +64 -30
- package/lib/theme/DocSidebarItem/styles.module.css +4 -0
- package/lib/theme/DocVersionBadge/index.js +34 -0
- package/lib/theme/DocVersionBanner/index.js +8 -8
- package/lib/theme-classic.d.ts +5 -4
- package/lib-next/theme/DocCard/index.js +80 -0
- package/lib-next/theme/DocCard/styles.module.css +43 -0
- package/lib-next/theme/DocCardList/index.js +19 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +49 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/lib-next/theme/DocItem/index.js +5 -12
- package/lib-next/theme/DocPage/index.js +31 -14
- package/lib-next/theme/DocPaginator/index.js +7 -11
- package/lib-next/theme/DocSidebar/index.js +10 -1
- package/lib-next/theme/DocSidebarItem/index.js +78 -37
- package/lib-next/theme/DocSidebarItem/styles.module.css +4 -0
- package/lib-next/theme/DocVersionBadge/index.js +27 -0
- package/lib-next/theme/DocVersionBanner/index.js +12 -5
- package/lib-next/theme-classic.d.ts +5 -4
- package/package.json +13 -13
- package/src/theme/DocCard/index.tsx +100 -0
- package/src/theme/DocCard/styles.module.css +43 -0
- package/src/theme/DocCardList/index.tsx +27 -0
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +53 -0
- package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/src/theme/DocItem/index.tsx +5 -12
- package/src/theme/DocPage/index.tsx +28 -12
- package/src/theme/DocPaginator/index.tsx +9 -13
- package/src/theme/DocSidebar/index.tsx +9 -1
- package/src/theme/DocSidebarItem/index.tsx +77 -38
- package/src/theme/DocSidebarItem/styles.module.css +4 -0
- package/src/theme/DocVersionBadge/index.tsx +30 -0
- package/src/theme/DocVersionBanner/index.tsx +23 -7
- package/src/theme-classic.d.ts +5 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {ThemeClassNames, useDocsVersion} from '@docusaurus/theme-common';
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import type {Props} from '@theme/DocVersionBadge';
|
|
12
|
+
|
|
13
|
+
export default function DocVersionBadge({
|
|
14
|
+
className,
|
|
15
|
+
}: Props): JSX.Element | null {
|
|
16
|
+
const versionMetadata = useDocsVersion();
|
|
17
|
+
if (versionMetadata.badge) {
|
|
18
|
+
return (
|
|
19
|
+
<span
|
|
20
|
+
className={clsx(
|
|
21
|
+
className,
|
|
22
|
+
ThemeClassNames.docs.docVersionBadge,
|
|
23
|
+
'badge badge--secondary',
|
|
24
|
+
)}>
|
|
25
|
+
Version: {versionMetadata.label}
|
|
26
|
+
</span>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
@@ -17,15 +17,19 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
ThemeClassNames,
|
|
19
19
|
useDocsPreferredVersion,
|
|
20
|
+
useDocsVersion,
|
|
20
21
|
} from '@docusaurus/theme-common';
|
|
21
22
|
|
|
22
23
|
import type {Props} from '@theme/DocVersionBanner';
|
|
23
24
|
import clsx from 'clsx';
|
|
24
|
-
import type {
|
|
25
|
+
import type {
|
|
26
|
+
VersionBanner,
|
|
27
|
+
PropVersionMetadata,
|
|
28
|
+
} from '@docusaurus/plugin-content-docs';
|
|
25
29
|
|
|
26
30
|
type BannerLabelComponentProps = {
|
|
27
31
|
siteTitle: string;
|
|
28
|
-
versionMetadata:
|
|
32
|
+
versionMetadata: PropVersionMetadata;
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
function UnreleasedVersionLabel({
|
|
@@ -114,7 +118,12 @@ function LatestVersionSuggestionLabel({
|
|
|
114
118
|
);
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
function DocVersionBannerEnabled({
|
|
121
|
+
function DocVersionBannerEnabled({
|
|
122
|
+
className,
|
|
123
|
+
versionMetadata,
|
|
124
|
+
}: Props & {
|
|
125
|
+
versionMetadata: PropVersionMetadata;
|
|
126
|
+
}): JSX.Element {
|
|
118
127
|
const {
|
|
119
128
|
siteConfig: {title: siteTitle},
|
|
120
129
|
} = useDocusaurusContext();
|
|
@@ -136,6 +145,7 @@ function DocVersionBannerEnabled({versionMetadata}: Props): JSX.Element {
|
|
|
136
145
|
return (
|
|
137
146
|
<div
|
|
138
147
|
className={clsx(
|
|
148
|
+
className,
|
|
139
149
|
ThemeClassNames.docs.docVersionBanner,
|
|
140
150
|
'alert alert--warning margin-bottom--md',
|
|
141
151
|
)}
|
|
@@ -154,11 +164,17 @@ function DocVersionBannerEnabled({versionMetadata}: Props): JSX.Element {
|
|
|
154
164
|
);
|
|
155
165
|
}
|
|
156
166
|
|
|
157
|
-
function DocVersionBanner({
|
|
167
|
+
export default function DocVersionBanner({
|
|
168
|
+
className,
|
|
169
|
+
}: Props): JSX.Element | null {
|
|
170
|
+
const versionMetadata = useDocsVersion();
|
|
158
171
|
if (versionMetadata.banner) {
|
|
159
|
-
return
|
|
172
|
+
return (
|
|
173
|
+
<DocVersionBannerEnabled
|
|
174
|
+
className={className}
|
|
175
|
+
versionMetadata={versionMetadata}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
160
178
|
}
|
|
161
179
|
return null;
|
|
162
180
|
}
|
|
163
|
-
|
|
164
|
-
export default DocVersionBanner;
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -107,11 +107,12 @@ declare module '@theme/CodeBlock' {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
declare module '@theme/DocPaginator' {
|
|
110
|
+
import type {PropNavigation} from '@docusaurus/plugin-content-docs';
|
|
111
|
+
|
|
110
112
|
type PageInfo = {readonly permalink: string; readonly title: string};
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
114
|
+
// May be simpler to provide a {navigation: PropNavigation} prop?
|
|
115
|
+
export interface Props extends PropNavigation {}
|
|
115
116
|
|
|
116
117
|
const DocPaginator: (props: Props) => JSX.Element;
|
|
117
118
|
export default DocPaginator;
|
|
@@ -138,7 +139,7 @@ declare module '@theme/DocSidebarItem' {
|
|
|
138
139
|
|
|
139
140
|
type DocSidebarPropsBase = {
|
|
140
141
|
readonly activePath: string;
|
|
141
|
-
readonly onItemClick?: () => void;
|
|
142
|
+
readonly onItemClick?: (item: PropSidebarItem) => void;
|
|
142
143
|
readonly level: number;
|
|
143
144
|
readonly tabIndex?: number;
|
|
144
145
|
};
|