@patternfly/documentation-framework 6.0.0-alpha.12 → 6.0.0-alpha.121
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/CHANGELOG.md +1501 -0
- package/README.md +5 -76
- package/app.js +2 -5
- package/components/autoLinkHeader/autoLinkHeader.css +2 -2
- package/components/autoLinkHeader/autoLinkHeader.js +9 -19
- package/components/cssVariables/cssVariables.css +9 -11
- package/components/cssVariables/cssVariables.js +19 -32
- package/components/example/example.css +6 -50
- package/components/example/example.js +149 -78
- package/components/example/exampleToolbar.js +3 -2
- package/components/footer/RHLogoDark.png +0 -0
- package/components/footer/footer.css +31 -93
- package/components/footer/footer.js +167 -96
- package/components/gdprBanner/gdprBanner.css +0 -3
- package/components/gdprBanner/gdprBanner.js +22 -16
- package/components/inlineAlert/inlineAlert.js +1 -1
- package/components/link/link.js +23 -18
- package/components/propsTable/propsTable.js +14 -10
- package/components/sectionGallery/TextSummary.js +10 -10
- package/components/sectionGallery/sectionDataListLayout.js +89 -43
- package/components/sectionGallery/sectionGallery.css +3 -36
- package/components/sectionGallery/sectionGalleryLayout.js +73 -23
- package/components/sectionGallery/sectionGalleryToolbar.js +48 -12
- package/components/sectionGallery/sectionGalleryWrapper.js +69 -31
- package/components/sideNav/sideNav.js +2 -3
- package/components/tableOfContents/tableOfContents.css +21 -30
- package/components/tableOfContents/tableOfContents.js +58 -28
- package/layouts/sideNavLayout/sideNavLayout.css +0 -35
- package/layouts/sideNavLayout/sideNavLayout.js +177 -92
- package/package.json +14 -21
- package/pages/404/404.css +2 -2
- package/pages/404/index.js +23 -36
- package/routes.js +3 -1
- package/scripts/md/anchor-header.js +1 -1
- package/scripts/md/parseMD.js +23 -21
- package/scripts/md/styled-tags.js +22 -14
- package/scripts/md/typecheck.js +5 -0
- package/scripts/webpack/prerender.js +2 -1
- package/scripts/webpack/webpack.base.config.js +7 -18
- package/scripts/writeScreenshots.js +1 -1
- package/templates/mdx.css +11 -288
- package/templates/mdx.js +36 -39
- package/templates/patternfly-docs/patternfly-docs.source.js +8 -8
- package/versions.json +187 -17
- package/components/sideNav/sideNav.css +0 -21
- package/pages/global-css-variables.md +0 -109
- package/pages/img/component-variable-mapping.png +0 -0
|
@@ -1,51 +1,97 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
DataList,
|
|
4
|
+
DataListItem,
|
|
5
|
+
DataListItemRow,
|
|
6
|
+
DataListItemCells,
|
|
7
|
+
DataListCell,
|
|
8
|
+
Split,
|
|
9
|
+
SplitItem,
|
|
10
|
+
Content,
|
|
11
|
+
ContentVariants,
|
|
12
|
+
Label,
|
|
13
|
+
} from "@patternfly/react-core";
|
|
14
|
+
import { Link } from "../link/link";
|
|
15
|
+
import { TextSummary } from "./TextSummary";
|
|
5
16
|
|
|
6
|
-
export const SectionDataListLayout = ({
|
|
7
|
-
|
|
17
|
+
export const SectionDataListLayout = ({
|
|
18
|
+
galleryItems,
|
|
19
|
+
layoutView,
|
|
20
|
+
hasListText,
|
|
21
|
+
hasListImages,
|
|
22
|
+
}) => {
|
|
23
|
+
if (layoutView !== "list") {
|
|
8
24
|
return null;
|
|
9
25
|
}
|
|
10
|
-
|
|
26
|
+
|
|
11
27
|
return (
|
|
12
28
|
<DataList onSelectDataListItem={() => {}}>
|
|
13
|
-
{galleryItems.map(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
{galleryItems.map(
|
|
30
|
+
({
|
|
31
|
+
idx,
|
|
32
|
+
slug,
|
|
33
|
+
illustration,
|
|
34
|
+
itemName,
|
|
35
|
+
title,
|
|
36
|
+
isBeta,
|
|
37
|
+
isDeprecated,
|
|
38
|
+
isDemo,
|
|
39
|
+
id,
|
|
40
|
+
galleryItemsData,
|
|
41
|
+
}) => (
|
|
42
|
+
<Link to={slug} key={idx} className="ws-section-gallery-item">
|
|
43
|
+
<DataListItem>
|
|
44
|
+
<DataListItemRow>
|
|
45
|
+
<DataListItemCells
|
|
46
|
+
dataListCells={[
|
|
47
|
+
hasListImages && illustration && (
|
|
48
|
+
<DataListCell width={1} key="illustration">
|
|
49
|
+
<div>
|
|
50
|
+
<img
|
|
51
|
+
src={illustration}
|
|
52
|
+
alt={`${itemName} illustration`}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</DataListCell>
|
|
56
|
+
),
|
|
57
|
+
<DataListCell width={5} key="text-description">
|
|
58
|
+
<Split className={hasListText ? "pf-v6-u-mb-md" : null}>
|
|
59
|
+
<SplitItem isFilled>
|
|
60
|
+
<Content isEditorial>
|
|
61
|
+
<Content component={ContentVariants.h2}>
|
|
62
|
+
<span>{title}</span>
|
|
63
|
+
</Content>
|
|
64
|
+
</Content>
|
|
65
|
+
</SplitItem>
|
|
66
|
+
<SplitItem>
|
|
67
|
+
{isBeta && (
|
|
68
|
+
<Label color="blue" isCompact>
|
|
69
|
+
Beta
|
|
70
|
+
</Label>
|
|
71
|
+
)}
|
|
72
|
+
{!isBeta && isDeprecated && (
|
|
73
|
+
<Label color="grey" isCompact>
|
|
74
|
+
Deprecated
|
|
75
|
+
</Label>
|
|
76
|
+
)}
|
|
77
|
+
{!isBeta && !isDeprecated && isDemo && (
|
|
78
|
+
<Label color="purple" isCompact>
|
|
79
|
+
Demo
|
|
80
|
+
</Label>
|
|
81
|
+
)}
|
|
82
|
+
</SplitItem>
|
|
83
|
+
</Split>
|
|
84
|
+
{hasListText && (
|
|
85
|
+
<TextSummary id={id} itemsData={galleryItemsData} />
|
|
86
|
+
)}
|
|
87
|
+
</DataListCell>,
|
|
88
|
+
]}
|
|
89
|
+
/>
|
|
90
|
+
</DataListItemRow>
|
|
91
|
+
</DataListItem>
|
|
92
|
+
</Link>
|
|
93
|
+
)
|
|
94
|
+
)}
|
|
49
95
|
</DataList>
|
|
50
|
-
)
|
|
96
|
+
);
|
|
51
97
|
};
|
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
.ws-landing-page > * {
|
|
2
|
-
max-width: 832px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.ws-landing-page > .ws-section-gallery-full-width {
|
|
6
|
-
max-width: initial;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.ws-section-gallery {
|
|
10
|
-
/* top placement */
|
|
11
|
-
margin-top: calc(var(--pf-v6-c-page__main-section--PaddingTop) * -1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
* + .ws-section-gallery {
|
|
15
|
-
/* top placement */
|
|
16
|
-
margin-top: unset;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
1
|
/* Toolbar styles */
|
|
20
2
|
.ws-section-gallery .pf-v6-c-toolbar {
|
|
21
|
-
margin-
|
|
22
|
-
border-bottom: var(--pf-v6-c-page__sidebar--m-light--BorderRightWidth) solid var(--pf-v6-c-page__sidebar--m-light--BorderRightColor);
|
|
23
|
-
margin-bottom: var(--pf-v6-global--spacer--md);
|
|
24
|
-
width: calc(100% + var(--pf-v6-c-page__main-section--PaddingLeft) + var(--pf-v6-c-page__main-section--PaddingRight));
|
|
25
|
-
/* avoid hoverable data list items overlapping toolbar */
|
|
26
|
-
z-index: calc(var(--pf-v6-global--ZIndex--xs) + 2);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* Match toolbar left-padding to gallery left-padding */
|
|
30
|
-
.ws-section-gallery .pf-v6-c-toolbar .pf-v6-c-toolbar__content {
|
|
31
|
-
--pf-v6-c-toolbar__content--PaddingLeft: var(--pf-v6-c-page__main-section--PaddingLeft);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* Avoid toolbar wrap on smaller screens */
|
|
35
|
-
.ws-section-gallery .pf-v6-c-toolbar__content-section {
|
|
36
|
-
flex-wrap: nowrap;
|
|
3
|
+
margin-block-end: var(--pf-t--global--spacer--md);
|
|
37
4
|
}
|
|
38
5
|
|
|
39
6
|
/* Avoid link styling on gallery/data list item names */
|
|
@@ -42,12 +9,12 @@
|
|
|
42
9
|
color: inherit;
|
|
43
10
|
}
|
|
44
11
|
|
|
45
|
-
/* Ensure
|
|
12
|
+
/* Ensure cards within a row stretch vertically to fill row height */
|
|
46
13
|
.ws-section-gallery .pf-v6-c-card {
|
|
47
14
|
height: 100%;
|
|
48
15
|
}
|
|
49
16
|
|
|
50
17
|
/* Limit width for data list view only */
|
|
51
18
|
.ws-section-gallery .pf-v6-c-data-list {
|
|
52
|
-
max-width:
|
|
19
|
+
max-width: var(--pf-t--global--breakpoint--lg);
|
|
53
20
|
}
|
|
@@ -1,41 +1,91 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Gallery,
|
|
4
|
+
GalleryItem,
|
|
5
|
+
Card,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
CardBody,
|
|
9
|
+
CardFooter,
|
|
10
|
+
Label,
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
import { navigate } from '@reach/router';
|
|
13
|
+
import { TextSummary } from './TextSummary';
|
|
5
14
|
|
|
6
|
-
export const SectionGalleryLayout = ({
|
|
15
|
+
export const SectionGalleryLayout = ({
|
|
16
|
+
galleryItems,
|
|
17
|
+
layoutView,
|
|
18
|
+
hasGridText,
|
|
19
|
+
hasGridImages,
|
|
20
|
+
}) => {
|
|
7
21
|
if (layoutView !== 'grid') {
|
|
8
22
|
return null;
|
|
9
23
|
}
|
|
10
24
|
|
|
11
25
|
return (
|
|
12
26
|
<Gallery hasGutter>
|
|
13
|
-
{galleryItems.map(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
{galleryItems.map(
|
|
28
|
+
({
|
|
29
|
+
idx,
|
|
30
|
+
slug,
|
|
31
|
+
id,
|
|
32
|
+
itemName,
|
|
33
|
+
illustration,
|
|
34
|
+
isBeta,
|
|
35
|
+
isDeprecated,
|
|
36
|
+
isDemo,
|
|
37
|
+
title,
|
|
38
|
+
galleryItemsData,
|
|
39
|
+
}) => (
|
|
40
|
+
<GalleryItem span={4} key={idx}>
|
|
41
|
+
<Card id={id} key={idx} isClickable>
|
|
42
|
+
<CardHeader
|
|
43
|
+
selectableActions={{
|
|
44
|
+
onClickAction: (e) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
document.getElementById('ws-page-main').scrollIntoView();
|
|
47
|
+
navigate(slug);
|
|
48
|
+
},
|
|
49
|
+
selectableActionId: `${id}-input`,
|
|
50
|
+
selectableActionAriaLabelledby: id,
|
|
51
|
+
name: `clickable-card-${idx}`,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<CardTitle>{title}</CardTitle>
|
|
55
|
+
</CardHeader>
|
|
22
56
|
{(hasGridImages || hasGridText) && (
|
|
23
57
|
<CardBody>
|
|
24
|
-
{
|
|
25
|
-
|
|
58
|
+
{hasGridImages && illustration && (
|
|
59
|
+
<img src={illustration} alt={`${itemName} illustration`} />
|
|
60
|
+
)}
|
|
61
|
+
{hasGridText && (
|
|
62
|
+
<TextSummary id={id} itemsData={galleryItemsData} />
|
|
63
|
+
)}
|
|
26
64
|
</CardBody>
|
|
27
65
|
)}
|
|
28
66
|
{(isBeta || isDeprecated || isDemo) && (
|
|
29
67
|
<CardFooter>
|
|
30
|
-
{isBeta && (
|
|
31
|
-
|
|
32
|
-
|
|
68
|
+
{isBeta && (
|
|
69
|
+
<Label color="blue" isCompact>
|
|
70
|
+
Beta
|
|
71
|
+
</Label>
|
|
72
|
+
)}
|
|
73
|
+
{!isBeta && isDeprecated && (
|
|
74
|
+
<Label color="grey" isCompact>
|
|
75
|
+
Deprecated
|
|
76
|
+
</Label>
|
|
77
|
+
)}
|
|
78
|
+
{!isBeta && !isDeprecated && isDemo && (
|
|
79
|
+
<Label color="purple" isCompact>
|
|
80
|
+
Demo
|
|
81
|
+
</Label>
|
|
82
|
+
)}
|
|
33
83
|
</CardFooter>
|
|
34
84
|
)}
|
|
35
85
|
</Card>
|
|
36
|
-
</
|
|
37
|
-
|
|
38
|
-
)
|
|
86
|
+
</GalleryItem>
|
|
87
|
+
)
|
|
88
|
+
)}
|
|
39
89
|
</Gallery>
|
|
40
|
-
)
|
|
90
|
+
);
|
|
41
91
|
};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
SearchInput,
|
|
5
|
+
Toolbar,
|
|
6
|
+
ToolbarContent,
|
|
7
|
+
ToolbarGroup,
|
|
8
|
+
ToolbarItem,
|
|
9
|
+
Content,
|
|
10
|
+
ContentVariants,
|
|
11
|
+
ToggleGroup,
|
|
12
|
+
ToggleGroupItem,
|
|
13
|
+
} from "@patternfly/react-core";
|
|
14
|
+
import ListIcon from "@patternfly/react-icons/dist/esm/icons/list-icon";
|
|
15
|
+
import ThIcon from "@patternfly/react-icons/dist/esm/icons/th-icon";
|
|
5
16
|
|
|
6
17
|
export const SectionGalleryToolbar = ({
|
|
7
18
|
galleryItems,
|
|
@@ -9,29 +20,54 @@ export const SectionGalleryToolbar = ({
|
|
|
9
20
|
setSearchTerm,
|
|
10
21
|
layoutView,
|
|
11
22
|
setLayoutView,
|
|
12
|
-
placeholderText ="Search by name",
|
|
13
|
-
countText=" items"
|
|
23
|
+
placeholderText = "Search by name",
|
|
24
|
+
countText = " items",
|
|
14
25
|
}) => (
|
|
15
26
|
<Toolbar isSticky>
|
|
16
27
|
<ToolbarContent>
|
|
17
|
-
<ToolbarItem
|
|
18
|
-
<SearchInput
|
|
28
|
+
<ToolbarItem>
|
|
29
|
+
<SearchInput
|
|
30
|
+
onClear={false}
|
|
31
|
+
value={searchTerm}
|
|
32
|
+
placeholder={placeholderText}
|
|
33
|
+
onChange={(_evt, val) => setSearchTerm(val)}
|
|
34
|
+
/>
|
|
19
35
|
</ToolbarItem>
|
|
20
36
|
{searchTerm && (
|
|
21
37
|
<ToolbarItem>
|
|
22
|
-
<Button variant="link" onClick={() => setSearchTerm(
|
|
38
|
+
<Button variant="link" onClick={() => setSearchTerm("")}>
|
|
39
|
+
Reset
|
|
40
|
+
</Button>
|
|
23
41
|
</ToolbarItem>
|
|
24
42
|
)}
|
|
25
43
|
<ToolbarGroup variant="icon-button-group">
|
|
26
44
|
<ToolbarItem>
|
|
27
45
|
<ToggleGroup>
|
|
28
|
-
<ToggleGroupItem
|
|
29
|
-
|
|
46
|
+
<ToggleGroupItem
|
|
47
|
+
icon={<ThIcon />}
|
|
48
|
+
aria-label="grid icon button"
|
|
49
|
+
isSelected={layoutView === "grid"}
|
|
50
|
+
onChange={() => setLayoutView("grid")}
|
|
51
|
+
></ToggleGroupItem>
|
|
52
|
+
<ToggleGroupItem
|
|
53
|
+
icon={<ListIcon />}
|
|
54
|
+
aria-label="list icon button"
|
|
55
|
+
isSelected={layoutView === "list"}
|
|
56
|
+
onChange={() => setLayoutView("list")}
|
|
57
|
+
></ToggleGroupItem>
|
|
30
58
|
</ToggleGroup>
|
|
31
59
|
</ToolbarItem>
|
|
32
60
|
</ToolbarGroup>
|
|
33
|
-
<ToolbarItem
|
|
34
|
-
|
|
61
|
+
<ToolbarItem
|
|
62
|
+
variant="pagination"
|
|
63
|
+
gap={{ default: "gapMd", md: "gapNone" }}
|
|
64
|
+
style={{ "--pf-v6-c-toolbar__item--MinWidth": "max-content" }}
|
|
65
|
+
className="pf-m-align-self-center"
|
|
66
|
+
>
|
|
67
|
+
<Content isEditorial component={ContentVariants.small}>
|
|
68
|
+
{galleryItems.length}
|
|
69
|
+
{countText}
|
|
70
|
+
</Content>
|
|
35
71
|
</ToolbarItem>
|
|
36
72
|
</ToolbarContent>
|
|
37
73
|
</Toolbar>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { groupedRoutes } from '../../routes';
|
|
3
3
|
|
|
4
4
|
export const SectionGalleryWrapper = ({
|
|
@@ -10,9 +10,11 @@ export const SectionGalleryWrapper = ({
|
|
|
10
10
|
parseSubsections,
|
|
11
11
|
initialLayout,
|
|
12
12
|
isFullWidth,
|
|
13
|
-
children
|
|
13
|
+
children,
|
|
14
14
|
}) => {
|
|
15
|
-
let sectionRoutes = subsection
|
|
15
|
+
let sectionRoutes = subsection
|
|
16
|
+
? groupedRoutes[section][subsection]
|
|
17
|
+
: groupedRoutes[section];
|
|
16
18
|
if (!includeSubsections || parseSubsections) {
|
|
17
19
|
const sectionRoutesArr = Object.entries(sectionRoutes);
|
|
18
20
|
// loop through galleryItems object and build new object to handle subsections
|
|
@@ -32,22 +34,21 @@ export const SectionGalleryWrapper = ({
|
|
|
32
34
|
if (subitemName !== 'isSubsection') {
|
|
33
35
|
acc[subitemName] = subitemData;
|
|
34
36
|
}
|
|
35
|
-
})
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
return acc;
|
|
38
|
-
}, {})
|
|
40
|
+
}, {});
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
42
44
|
const [layoutView, setLayoutView] = React.useState(initialLayout);
|
|
43
|
-
const filteredItems = Object.entries(sectionRoutes)
|
|
44
|
-
|
|
45
|
-
// exclude current gallery page from results
|
|
45
|
+
const filteredItems = Object.entries(sectionRoutes).filter(
|
|
46
|
+
([itemName, { slug }]) =>
|
|
47
|
+
// exclude current gallery page from results - check for trailing /
|
|
46
48
|
!location.pathname.endsWith(slug) &&
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
));
|
|
49
|
+
!location.pathname.endsWith(`${slug}/`) &&
|
|
50
|
+
itemName.toLowerCase().includes(searchTerm.toLowerCase())
|
|
51
|
+
);
|
|
51
52
|
const sectionGalleryItems = filteredItems
|
|
52
53
|
.sort(([itemName1], [itemName2]) => itemName1.localeCompare(itemName2))
|
|
53
54
|
.map(([itemName, itemData], idx) => {
|
|
@@ -56,36 +57,63 @@ export const SectionGalleryWrapper = ({
|
|
|
56
57
|
// Convert to lowercase-camelcase ex: File upload - multiple ==> file_upload_multiple
|
|
57
58
|
const illustrationName = itemName
|
|
58
59
|
.replace('-', '')
|
|
59
|
-
.replace(' ',' ')
|
|
60
|
+
.replace(' ', ' ')
|
|
60
61
|
.split(' ')
|
|
61
62
|
.join('_')
|
|
62
63
|
.toLowerCase();
|
|
63
|
-
illustration =
|
|
64
|
+
illustration =
|
|
65
|
+
illustrations[illustrationName] || illustrations.default_placeholder;
|
|
64
66
|
}
|
|
65
67
|
const { sources, isSubsection = false } = itemData;
|
|
66
68
|
// Subsections don't have title or id, default to itemName aka sidenav text
|
|
67
69
|
const title = itemData.title || itemName;
|
|
68
70
|
const id = itemData.id || title;
|
|
69
71
|
// Display beta label if tab other than a '-next' tab is marked Beta
|
|
70
|
-
const isDeprecated =
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
const isDeprecated =
|
|
73
|
+
!isSubsection &&
|
|
74
|
+
sources &&
|
|
75
|
+
sources.some(
|
|
76
|
+
(source) =>
|
|
77
|
+
source.source === 'react-deprecated' ||
|
|
78
|
+
source.source === 'html-deprecated'
|
|
79
|
+
) &&
|
|
80
|
+
!sources.some(
|
|
81
|
+
(source) => source.source === 'react' || source.source === 'html'
|
|
82
|
+
);
|
|
83
|
+
const isBeta =
|
|
84
|
+
!isSubsection &&
|
|
85
|
+
sources &&
|
|
86
|
+
sources.some((src) => src.beta && !src.source.includes('-next'));
|
|
87
|
+
const isDemo =
|
|
88
|
+
!isSubsection &&
|
|
89
|
+
sources &&
|
|
90
|
+
sources.some(
|
|
91
|
+
(source) =>
|
|
92
|
+
source.source === 'react-demos' || source.source === 'html-demos'
|
|
93
|
+
) &&
|
|
94
|
+
!sources.some(
|
|
95
|
+
(source) => source.source === 'react' || source.source === 'html'
|
|
96
|
+
);
|
|
73
97
|
|
|
74
98
|
let slug = itemData.slug;
|
|
75
99
|
if (!slug && isSubsection) {
|
|
76
100
|
// Update slug to link to first page in subsection
|
|
77
|
-
const subsectionItems = Object.entries(itemData).filter(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
const subsectionItems = Object.entries(itemData).filter(
|
|
102
|
+
([name, _data]) => name !== 'isSubsection'
|
|
103
|
+
);
|
|
104
|
+
const sortedSubsectionItems = subsectionItems.sort(
|
|
105
|
+
(
|
|
106
|
+
[name1, { sortValue: sortValue1 = 50 }],
|
|
107
|
+
[name2, { sortValue: sortValue2 = 50 }]
|
|
108
|
+
) => {
|
|
109
|
+
if (sortValue1 === sortValue2) {
|
|
110
|
+
return name1.localeCompare(name2);
|
|
111
|
+
}
|
|
112
|
+
return sortValue1 > sortValue2 ? 1 : -1;
|
|
84
113
|
}
|
|
85
|
-
|
|
86
|
-
});
|
|
114
|
+
);
|
|
87
115
|
const firstSubsectionItem = sortedSubsectionItems[0];
|
|
88
|
-
slug = firstSubsectionItem[1].slug;
|
|
116
|
+
slug = firstSubsectionItem[1].slug;
|
|
89
117
|
}
|
|
90
118
|
|
|
91
119
|
return {
|
|
@@ -98,13 +126,23 @@ export const SectionGalleryWrapper = ({
|
|
|
98
126
|
isDemo,
|
|
99
127
|
title,
|
|
100
128
|
id,
|
|
101
|
-
galleryItemsData
|
|
129
|
+
galleryItemsData,
|
|
102
130
|
};
|
|
103
131
|
});
|
|
104
132
|
|
|
105
133
|
return (
|
|
106
|
-
<div
|
|
107
|
-
{
|
|
134
|
+
<div
|
|
135
|
+
className={`ws-section-gallery${
|
|
136
|
+
isFullWidth ? ' ws-section-gallery-full-width' : ''
|
|
137
|
+
}`}
|
|
138
|
+
>
|
|
139
|
+
{children(
|
|
140
|
+
sectionGalleryItems,
|
|
141
|
+
searchTerm,
|
|
142
|
+
setSearchTerm,
|
|
143
|
+
layoutView,
|
|
144
|
+
setLayoutView
|
|
145
|
+
)}
|
|
108
146
|
</div>
|
|
109
|
-
)
|
|
147
|
+
);
|
|
110
148
|
};
|
|
@@ -4,7 +4,7 @@ import { Label, Nav, NavList, NavExpandable, PageContextConsumer, capitalize, Fl
|
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
import { Location } from '@reach/router';
|
|
6
6
|
import { makeSlug } from '../../helpers';
|
|
7
|
-
import globalBreakpointXl from "@patternfly/react-tokens/dist/esm/
|
|
7
|
+
import globalBreakpointXl from "@patternfly/react-tokens/dist/esm/t_global_breakpoint_xl";
|
|
8
8
|
import { trackEvent } from '../../helpers';
|
|
9
9
|
|
|
10
10
|
const getIsActive = (location, section, subsection = null) => {
|
|
@@ -67,7 +67,6 @@ const ExpandableNav = ({groupedRoutes, location, section, subsection = null}) =>
|
|
|
67
67
|
key={capitalize(currentSection.replace(/-/g, ' '))}
|
|
68
68
|
isActive={isActive}
|
|
69
69
|
isExpanded={isActive}
|
|
70
|
-
className="ws-side-nav-group"
|
|
71
70
|
onClick={(event) => {
|
|
72
71
|
// Don't bubble click event up, avoids subsection triggering duplicate analtics
|
|
73
72
|
event.stopPropagation();
|
|
@@ -96,7 +95,7 @@ const ExpandableNav = ({groupedRoutes, location, section, subsection = null}) =>
|
|
|
96
95
|
source.source === "react-deprecated" || source.source === "html-deprecated")
|
|
97
96
|
&& !navObj.sources.some(source => source.source === "react" || source.source === "html")
|
|
98
97
|
),
|
|
99
|
-
isBeta: navObj.sources.some(source => source.beta),
|
|
98
|
+
isBeta: navObj.sources.some(source => source.beta && source.source !== 'react-next' && source.source !== 'react-templates'),
|
|
100
99
|
isDemo: navObj.sources.some(source => (
|
|
101
100
|
source.source === "react-demos" || source.source === "html-demos")
|
|
102
101
|
&& !navObj.sources.some(source => source.source === "react" || source.source === "html")
|