@patternfly/documentation-framework 2.0.0-alpha.6 → 2.0.0-alpha.61

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +512 -0
  2. package/app.js +12 -12
  3. package/components/autoLinkHeader/autoLinkHeader.css +2 -2
  4. package/components/autoLinkHeader/autoLinkHeader.js +18 -13
  5. package/components/cssVariables/cssSearch.js +3 -4
  6. package/components/cssVariables/cssVariables.css +4 -4
  7. package/components/cssVariables/cssVariables.js +83 -84
  8. package/components/example/example.css +29 -29
  9. package/components/example/example.js +34 -6
  10. package/components/footer/footer.css +16 -16
  11. package/components/footer/footer.js +13 -13
  12. package/components/functionsTable/functionsTable.js +57 -0
  13. package/components/gdprBanner/gdprBanner.css +2 -2
  14. package/components/gdprBanner/gdprBanner.js +3 -3
  15. package/components/inlineAlert/inlineAlert.js +1 -1
  16. package/components/propsTable/propsTable.js +85 -79
  17. package/components/sectionGallery/TextSummary.js +31 -0
  18. package/components/sectionGallery/sectionDataListLayout.js +49 -0
  19. package/components/sectionGallery/sectionGallery.css +53 -0
  20. package/components/sectionGallery/sectionGallery.js +76 -0
  21. package/components/sectionGallery/sectionGalleryLayout.js +39 -0
  22. package/components/sectionGallery/sectionGalleryToolbar.js +38 -0
  23. package/components/sectionGallery/sectionGalleryWrapper.js +105 -0
  24. package/components/sideNav/sideNav.css +12 -12
  25. package/components/sideNav/sideNav.js +41 -13
  26. package/components/tableOfContents/tableOfContents.css +17 -17
  27. package/helpers/codesandbox.js +2 -2
  28. package/helpers/getTitle.js +2 -2
  29. package/layouts/sideNavLayout/sideNavLayout.css +7 -11
  30. package/layouts/sideNavLayout/sideNavLayout.js +57 -40
  31. package/package.json +28 -25
  32. package/pages/404/404.css +2 -2
  33. package/pages/404/index.js +1 -1
  34. package/pages/global-css-variables.md +16 -16
  35. package/routes.js +20 -8
  36. package/scripts/cli/build.js +6 -0
  37. package/scripts/cli/cli.js +2 -0
  38. package/scripts/cli/generate.js +2 -2
  39. package/scripts/cli/start.js +6 -8
  40. package/scripts/md/parseMD.js +46 -11
  41. package/scripts/md/styled-tags.js +8 -4
  42. package/scripts/tsDocgen.js +119 -91
  43. package/scripts/typeDocGen.js +209 -0
  44. package/scripts/webpack/webpack.base.config.js +34 -32
  45. package/scripts/webpack/webpack.client.config.js +11 -8
  46. package/scripts/webpack/webpack.server.config.js +8 -5
  47. package/scripts/writeScreenshots.js +3 -3
  48. package/templates/html.ejs +2 -4
  49. package/templates/mdx.css +156 -161
  50. package/templates/mdx.js +122 -51
  51. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
  52. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
  53. package/versions.json +29 -9
  54. package/components/topNav/topNav.css +0 -30
  55. package/pages/red-hat-font.md +0 -40
@@ -13,9 +13,9 @@ export const GdprBanner = () => {
13
13
  }
14
14
 
15
15
  return !isBannerOpen ? null : (
16
- <div className="ws-gdpr-banner-container pf-l-flex">
17
- <div id="ws-gdpr-banner" className="pf-l-flex pf-u-py-md pf-m-align-items-center">
18
- <p id="ws-gdpr-banner-text" className="pf-u-ml-xl">
16
+ <div className="ws-gdpr-banner-container pf-v5-l-flex">
17
+ <div id="ws-gdpr-banner" className="pf-v5-l-flex pf-v5-u-py-md pf-m-align-items-center">
18
+ <p id="ws-gdpr-banner-text" className="pf-v5-u-ml-xl">
19
19
  We use cookies on our websites to deliver our online services.
20
20
  Details about how we use cookies and how you may disable them are set out in our <a href="//www.redhat.com/en/about/privacy-policy">Privacy Statement</a>.
21
21
  By using this website you agree to our use of cookies.
@@ -9,7 +9,7 @@ export const InlineAlert = ({
9
9
  <Alert
10
10
  variant={variant}
11
11
  title={title}
12
- className="pf-u-my-md"
12
+ className="pf-v5-u-my-md"
13
13
  style={{ marginBottom: '1rem' }}
14
14
  isInline
15
15
  component="h2"
@@ -2,90 +2,96 @@ import React from "react";
2
2
  import { Badge } from "@patternfly/react-core";
3
3
  import {
4
4
  Table,
5
- TableHeader,
6
- TableBody,
7
- cellWidth,
5
+ Caption,
6
+ Thead,
7
+ Th,
8
+ Tr,
9
+ Tbody,
10
+ Td,
11
+ TableText
8
12
  } from "@patternfly/react-table";
9
13
  import { AutoLinkHeader } from "../autoLinkHeader/autoLinkHeader";
10
14
  import { PropTypeWithLinks } from "./propTypeWithLinks";
11
15
  import { css } from "@patternfly/react-styles";
12
16
  import accessibleStyles from "@patternfly/react-styles/css/utilities/Accessibility/accessibility";
13
17
 
14
- export const PropsTable = ({ title, description, rows, allPropComponents }) => {
15
- const columns = [
16
- { title: "Name", transforms: [cellWidth(20)] },
17
- { title: "Type", transforms: [cellWidth(20)] },
18
- { title: "Default", transforms: [] },
19
- { title: "Description", transforms: [] },
20
- ];
21
-
22
- return (
23
- <React.Fragment>
24
- <AutoLinkHeader size="h3">{title}</AutoLinkHeader>
25
- <Table
26
- className="pf-u-mt-md pf-u-mb-lg"
27
- variant="compact"
28
- aria-label={title}
29
- caption={
30
- <div>
31
- {description && <div className="pf-u-mb-md">{description}</div>}
32
- <div>
33
- <span className="ws-prop-required">*</span>required
34
- </div>
35
- </div>
36
- }
37
- cells={columns}
38
- gridBreakPoint="grid-lg"
39
- rows={rows
40
- // Sort required rows first
18
+ export const PropsTable = ({ title, description, rows, allPropComponents }) => (
19
+ <React.Fragment>
20
+ <AutoLinkHeader size="h3">{title}</AutoLinkHeader>
21
+ <Table className="pf-v5-u-mt-md pf-v5-u-mb-lg" variant="compact" aria-label={title} gridBreakPoint="grid-lg">
22
+ <Caption>
23
+ {description && <div className="pf-v5-u-mb-md">{description}</div>}
24
+ <div>
25
+ <span className="ws-prop-required">*</span>required
26
+ </div>
27
+ </Caption>
28
+ <Thead>
29
+ <Tr>
30
+ <Th width={20}>Name</Th>
31
+ <Th width={20}>Type</Th>
32
+ <Th>Default</Th>
33
+ <Th>Description</Th>
34
+ </Tr>
35
+ </Thead>
36
+ <Tbody>
37
+ {rows
41
38
  .sort((a, b) => (a.required === b.required ? 0 : a.required ? -1 : 1))
42
- .map((row, idx) => ({
43
- cells: [
44
- <div className="pf-m-break-word">
45
- {row.deprecated && "Deprecated: "}
46
- {row.name}
47
- {row.required ? (
48
- <React.Fragment key={`${row.name}-required-prop`}>
49
- <span
50
- aria-hidden="true"
51
- key={`${row.name}-asterisk`}
52
- className="ws-prop-required"
53
- >
54
- *
55
- </span>
56
- <span
57
- key={`${row.name}-required`}
58
- className={css(accessibleStyles.screenReader)}
59
- >
60
- required
61
- </span>
62
- </React.Fragment>
63
- ) : (
64
- ""
65
- )}
66
- {row.beta && (
67
- <Badge
68
- key={`${row.name}-${idx}`}
69
- className="ws-beta-badge pf-u-ml-sm"
39
+ .map((row, idx) => (
40
+ <Tr key={idx}>
41
+ <Td>
42
+ <TableText wrapModifier="breakWord">
43
+ {row.deprecated && "Deprecated: "}
44
+ {row.name}
45
+ {row.required ? (
46
+ <React.Fragment key={`${row.name}-required-prop`}>
47
+ <span
48
+ aria-hidden="true"
49
+ key={`${row.name}-asterisk`}
50
+ className="ws-prop-required"
70
51
  >
71
- Beta
72
- </Badge>
73
- )}
74
- </div>,
75
- <div className="pf-m-break-word">
76
- <PropTypeWithLinks
77
- type={row.type}
78
- allPropComponents={allPropComponents}
79
- />
80
- </div>,
81
- <div className="pf-m-break-word">{row.defaultValue}</div>,
82
- <div className="pf-m-break-word">{row.description}</div>,
83
- ],
84
- }))}
85
- >
86
- <TableHeader />
87
- <TableBody />
88
- </Table>
89
- </React.Fragment>
90
- );
91
- };
52
+ *
53
+ </span>
54
+ <span
55
+ key={`${row.name}-required`}
56
+ className={css(accessibleStyles.screenReader)}
57
+ >
58
+ required
59
+ </span>
60
+ </React.Fragment>
61
+ ) : (
62
+ ""
63
+ )}
64
+ {row.beta && (
65
+ <Badge
66
+ key={`${row.name}-${idx}`}
67
+ className="ws-beta-badge pf-v5-u-ml-sm"
68
+ >
69
+ Beta
70
+ </Badge>
71
+ )}
72
+ </TableText>
73
+ </Td>
74
+ <Td>
75
+ <TableText wrapModifier="breakWord">
76
+ <PropTypeWithLinks
77
+ type={row.type}
78
+ allPropComponents={allPropComponents}
79
+ />
80
+ </TableText>
81
+ </Td>
82
+ <Td>
83
+ <TableText wrapModifier="breakWord">
84
+ {row.defaultValue}
85
+ </TableText>
86
+ </Td>
87
+ <Td>
88
+ <TableText wrapModifier="breakWord">
89
+ {row.description}
90
+ </TableText>
91
+ </Td>
92
+ </Tr>
93
+ ))}
94
+ </Tbody>
95
+ </Table>
96
+ </React.Fragment>
97
+ );
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { convertToReactComponent } from "@patternfly/ast-helpers";
3
+ import { TextContent, Text } from "@patternfly/react-core";
4
+
5
+ // convert summary text from string to jsx, remove links
6
+ export const SummaryComponent = ({ id, itemsData }) => {
7
+ const itemDasherized = id.split(' ').join('-').toLowerCase();
8
+ const summary = itemsData?.[itemDasherized]?.summary;
9
+ if (!summary) {
10
+ return null;
11
+ }
12
+ // Remove anchor tags to avoid <a> in summary nested within <a> of Link card/datalistitem
13
+ const summaryNoLinks = summary.replace(/<Link[^>]*>([^<]+)<\/Link>/gm, '$1');
14
+ const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`);
15
+ const getSummaryComponent = new Function('React', code);
16
+ return getSummaryComponent(React);
17
+ }
18
+
19
+ export const TextSummary = ({ id, itemsData }) => {
20
+ if (!id) {
21
+ return null;
22
+ }
23
+
24
+ return (
25
+ <TextContent>
26
+ <Text>
27
+ <SummaryComponent id={id} itemsData={itemsData} />
28
+ </Text>
29
+ </TextContent>
30
+ )
31
+ };
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCell, Split, SplitItem, TextContent, Text, TextVariants, Label } from "@patternfly/react-core";
3
+ import { Link } from '../link/link';
4
+ import { TextSummary } from './TextSummary';
5
+
6
+ export const SectionDataListLayout = ({ galleryItems, layoutView, hasListText, hasListImages }) => {
7
+ if (layoutView !== 'list') {
8
+ return null;
9
+ }
10
+
11
+ return (
12
+ <DataList onSelectDataListItem={() => {}}>
13
+ {galleryItems.map(({ idx, slug, illustration, itemName, title, isBeta, id, galleryItemsData }) => (
14
+ <Link to={slug} key={idx} className="ws-section-gallery-item">
15
+ <DataListItem>
16
+ <DataListItemRow>
17
+ <DataListItemCells dataListCells={[
18
+ hasListImages && illustration && (
19
+ <DataListCell width={1} key="illustration">
20
+ <div>
21
+ <img src={illustration} alt={`${itemName} illustration`} />
22
+ </div>
23
+ </DataListCell>
24
+ ),
25
+ <DataListCell width={5} key="text-description">
26
+ <Split className={ hasListText ? "pf-v5-u-mb-md" : null }>
27
+ <SplitItem isFilled>
28
+ <TextContent>
29
+ <Text component={TextVariants.h2}>
30
+ <span>
31
+ {title}
32
+ </span>
33
+ </Text>
34
+ </TextContent>
35
+ </SplitItem>
36
+ <SplitItem>
37
+ {isBeta && <Label color="gold">Beta feature</Label>}
38
+ </SplitItem>
39
+ </Split>
40
+ { hasListText && <TextSummary id={id} itemsData={galleryItemsData} /> }
41
+ </DataListCell>
42
+ ]} />
43
+ </DataListItemRow>
44
+ </DataListItem>
45
+ </Link>
46
+ ))}
47
+ </DataList>
48
+ )
49
+ };
@@ -0,0 +1,53 @@
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-v5-c-page__main-section--PaddingTop) * -1);
12
+ }
13
+
14
+ * + .ws-section-gallery {
15
+ /* top placement */
16
+ margin-top: unset;
17
+ }
18
+
19
+ /* Toolbar styles */
20
+ .ws-section-gallery .pf-v5-c-toolbar {
21
+ margin-left: calc(var(--pf-v5-c-page__main-section--PaddingLeft) * -1);
22
+ border-bottom: var(--pf-v5-c-page__sidebar--m-light--BorderRightWidth) solid var(--pf-v5-c-page__sidebar--m-light--BorderRightColor);
23
+ margin-bottom: var(--pf-v5-global--spacer--md);
24
+ width: calc(100% + var(--pf-v5-c-page__main-section--PaddingLeft) + var(--pf-v5-c-page__main-section--PaddingRight));
25
+ /* avoid hoverable data list items overlapping toolbar */
26
+ z-index: calc(var(--pf-v5-global--ZIndex--xs) + 2);
27
+ }
28
+
29
+ /* Match toolbar left-padding to gallery left-padding */
30
+ .ws-section-gallery .pf-v5-c-toolbar .pf-v5-c-toolbar__content {
31
+ --pf-v5-c-toolbar__content--PaddingLeft: var(--pf-v5-c-page__main-section--PaddingLeft);
32
+ }
33
+
34
+ /* Avoid toolbar wrap on smaller screens */
35
+ .ws-section-gallery .pf-v5-c-toolbar__content-section {
36
+ flex-wrap: nowrap;
37
+ }
38
+
39
+ /* Avoid link styling on gallery/data list item names */
40
+ .ws-section-gallery-item {
41
+ text-decoration: inherit;
42
+ color: inherit;
43
+ }
44
+
45
+ /* Ensure same height for all cards in a gallery row */
46
+ .ws-section-gallery .pf-v5-c-card {
47
+ height: 100%;
48
+ }
49
+
50
+ /* Limit width for data list view only */
51
+ .ws-section-gallery .pf-v5-c-data-list {
52
+ max-width: 956px;
53
+ }
@@ -0,0 +1,76 @@
1
+ import React from "react";
2
+
3
+ import './sectionGallery.css';
4
+ import { SectionGalleryToolbar } from "./sectionGalleryToolbar";
5
+ import { SectionGalleryLayout } from "./sectionGalleryLayout";
6
+ import { SectionDataListLayout } from "./sectionDataListLayout";
7
+ import { SectionGalleryWrapper } from "./sectionGalleryWrapper";
8
+
9
+ /**
10
+ * Helper component returns gallery of items with search toolbar and switchable gallery/data list views.
11
+ * @param {Object} illustrations - Object of preview images mapped to their snake_case item display name
12
+ * @param {string} section - Name of the navigation section to create the gallery within
13
+ * @param {Object} galleryItemsData - Object containing the image location & summary text mapped to the gallery item's hyphenated-name
14
+ * @param {string} [placeholderText=Search by name] - Optional text to be displayed as placeholder for SearchInput
15
+ * @param {string} [countText= items] - Optional text to be displayed after the number of search results
16
+ * @param {string} [initialLayout=grid] - Optional text to indicate whether to default to grid or list layout
17
+ * @param {Boolean} [hasGridText=false] - Optional boolean to toggle text on grid layout cards
18
+ * @param {Boolean} [hasGridImages=false] - Optional boolean to toggle images on grid layout cards
19
+ * @param {Boolean} [hasListText=false] - Optional boolean to toggle text on list layout rows
20
+ * @param {Boolean} [hasListImages=false] - Optional boolean to toggle images on list layout rows
21
+ * @param {Boolean} [isFullWidth=true] - Optional boolean to disable component from exceeding default max-width for page
22
+ */
23
+
24
+ export const SectionGallery = ({
25
+ illustrations,
26
+ section,
27
+ subsection = null,
28
+ includeSubsections = false,
29
+ parseSubsections = false,
30
+ galleryItemsData,
31
+ placeholderText,
32
+ countText,
33
+ initialLayout = "grid",
34
+ hasGridText = false,
35
+ hasGridImages = true,
36
+ hasListText = true,
37
+ hasListImages = true,
38
+ isFullWidth = true
39
+ }) => (
40
+ <SectionGalleryWrapper
41
+ illustrations={illustrations}
42
+ section={section}
43
+ subsection={subsection}
44
+ includeSubsections={includeSubsections}
45
+ parseSubsections={parseSubsections}
46
+ galleryItemsData={galleryItemsData}
47
+ initialLayout={initialLayout}
48
+ isFullWidth={isFullWidth}
49
+ >
50
+ {(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) => (
51
+ <>
52
+ <SectionGalleryToolbar
53
+ galleryItems={sectionGalleryItems}
54
+ searchTerm={searchTerm}
55
+ setSearchTerm={setSearchTerm}
56
+ layoutView={layoutView}
57
+ setLayoutView={setLayoutView}
58
+ placeholderText={placeholderText}
59
+ countText={countText}
60
+ />
61
+ <SectionGalleryLayout
62
+ galleryItems={sectionGalleryItems}
63
+ layoutView={layoutView}
64
+ hasGridText={hasGridText}
65
+ hasGridImages={hasGridImages}
66
+ />
67
+ <SectionDataListLayout
68
+ galleryItems={sectionGalleryItems}
69
+ layoutView={layoutView}
70
+ hasListText={hasListText}
71
+ hasListImages={hasListImages}
72
+ />
73
+ </>
74
+ )}
75
+ </SectionGalleryWrapper>
76
+ );
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { Gallery, GalleryItem, Card, CardTitle, CardBody, CardFooter, Label } from "@patternfly/react-core";
3
+ import { Link } from '../link/link';
4
+ import { TextSummary } from "./TextSummary";
5
+
6
+ export const SectionGalleryLayout = ({ galleryItems, layoutView, hasGridText, hasGridImages }) => {
7
+ if (layoutView !== 'grid') {
8
+ return null;
9
+ }
10
+
11
+ return (
12
+ <Gallery hasGutter>
13
+ {galleryItems.map(({idx, slug, id, itemName, illustration, isBeta, title, galleryItemsData}) => (
14
+ <GalleryItem span={4} key={idx}>
15
+ <Link to={slug} className="ws-section-gallery-item">
16
+ <Card
17
+ id={id}
18
+ key={idx}
19
+ isSelectableRaised
20
+ >
21
+ <CardTitle>{title}</CardTitle>
22
+ {(hasGridImages || hasGridText) && (
23
+ <CardBody>
24
+ { hasGridImages && illustration && <img src={illustration} alt={`${itemName} illustration`} /> }
25
+ { hasGridText && <TextSummary id={id} itemsData={galleryItemsData} /> }
26
+ </CardBody>
27
+ )}
28
+ {isBeta && (
29
+ <CardFooter>
30
+ <Label color="blue">Beta feature</Label>
31
+ </CardFooter>
32
+ )}
33
+ </Card>
34
+ </Link>
35
+ </GalleryItem>
36
+ ))}
37
+ </Gallery>
38
+ )
39
+ };
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { Button, SearchInput, Toolbar, ToolbarContent, ToolbarGroup, ToolbarItem, Text, TextVariants, ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
3
+ import ListIcon from '@patternfly/react-icons/dist/esm/icons/list-icon';
4
+ import ThIcon from'@patternfly/react-icons/dist/esm/icons/th-icon';
5
+
6
+ export const SectionGalleryToolbar = ({
7
+ galleryItems,
8
+ searchTerm,
9
+ setSearchTerm,
10
+ layoutView,
11
+ setLayoutView,
12
+ placeholderText ="Search by name",
13
+ countText=" items"
14
+ }) => (
15
+ <Toolbar isSticky>
16
+ <ToolbarContent>
17
+ <ToolbarItem variant="search-filter" widths={{default: '100%', md: '320px'}}>
18
+ <SearchInput onClear={false} value={searchTerm} placeholder={placeholderText} onChange={(_evt, val) => setSearchTerm(val)} />
19
+ </ToolbarItem>
20
+ {searchTerm && (
21
+ <ToolbarItem>
22
+ <Button variant="link" onClick={() => setSearchTerm('')}>Reset</Button>
23
+ </ToolbarItem>
24
+ )}
25
+ <ToolbarGroup variant="icon-button-group">
26
+ <ToolbarItem>
27
+ <ToggleGroup>
28
+ <ToggleGroupItem icon={<ThIcon />} aria-label="grid icon button" isSelected={layoutView === 'grid'} onChange={() => setLayoutView('grid')}></ToggleGroupItem>
29
+ <ToggleGroupItem icon={<ListIcon />} aria-label="list icon button" isSelected={layoutView === 'list'} onChange={() => setLayoutView('list')}></ToggleGroupItem>
30
+ </ToggleGroup>
31
+ </ToolbarItem>
32
+ </ToolbarGroup>
33
+ <ToolbarItem variant="pagination" spacer={{default: 'spacerMd', md: 'spacerNone'}} style={{'--pf-v5-c-toolbar__item--MinWidth': "max-content"}}>
34
+ <Text component={TextVariants.small}>{ galleryItems.length }{ countText }</Text>
35
+ </ToolbarItem>
36
+ </ToolbarContent>
37
+ </Toolbar>
38
+ );
@@ -0,0 +1,105 @@
1
+ import React from "react";
2
+ import { groupedRoutes } from '../../routes';
3
+
4
+ export const SectionGalleryWrapper = ({
5
+ section,
6
+ subsection,
7
+ galleryItemsData,
8
+ illustrations,
9
+ includeSubsections,
10
+ parseSubsections,
11
+ initialLayout,
12
+ isFullWidth,
13
+ children
14
+ }) => {
15
+ let sectionRoutes = subsection ? groupedRoutes[section][subsection] : groupedRoutes[section];
16
+ if (!includeSubsections || parseSubsections) {
17
+ const sectionRoutesArr = Object.entries(sectionRoutes);
18
+ // loop through galleryItems object and build new object to handle subsections
19
+ sectionRoutes = sectionRoutesArr.reduce((acc, [navName, routeData]) => {
20
+ // exit immediately if current item is isSubsection flag
21
+ if (navName === 'isSubsection') {
22
+ return acc;
23
+ }
24
+ // add current item
25
+ if (includeSubsections || !routeData.isSubsection) {
26
+ acc[navName] = routeData;
27
+ }
28
+ // drill down into current item if subsection and parseSubsections === true
29
+ if (parseSubsections && routeData.isSubsection) {
30
+ // loop through each subsection item & add
31
+ Object.entries(routeData).map(([subitemName, subitemData]) => {
32
+ if (subitemName !== 'isSubsection') {
33
+ acc[subitemName] = subitemData;
34
+ }
35
+ })
36
+ }
37
+ return acc;
38
+ }, {})
39
+ }
40
+
41
+ const [searchTerm, setSearchTerm] = React.useState('');
42
+ const [layoutView, setLayoutView] = React.useState(initialLayout);
43
+ const filteredItems = Object.entries(sectionRoutes)
44
+ .filter(([itemName, { slug }]) => (
45
+ // exclude current gallery page from results
46
+ !location.pathname.endsWith(slug) &&
47
+ itemName
48
+ .toLowerCase()
49
+ .includes(searchTerm.toLowerCase())
50
+ ));
51
+ const sectionGalleryItems = filteredItems
52
+ .sort(([itemName1], [itemName2]) => itemName1.localeCompare(itemName2))
53
+ .map(([itemName, itemData], idx) => {
54
+ let illustration = null;
55
+ if (illustrations) {
56
+ // Convert to lowercase-camelcase ex: File upload - multiple ==> file_upload_multiple
57
+ const illustrationName = itemName
58
+ .replace('-', '')
59
+ .replace(' ',' ')
60
+ .split(' ')
61
+ .join('_')
62
+ .toLowerCase();
63
+ illustration = illustrations[illustrationName] || illustrations.default_placeholder;
64
+ }
65
+ const { sources, isSubsection = false } = itemData;
66
+ // Subsections don't have title or id, default to itemName aka sidenav text
67
+ const title = itemData.title || itemName;
68
+ const id = itemData.id || title;
69
+ // Display beta label if tab other than a '-next' tab is marked Beta
70
+ const isBeta = !isSubsection && sources && sources.some(src => src.beta && !src.source.includes('-next'));
71
+ let slug = itemData.slug;
72
+ if (!slug && isSubsection) {
73
+ // Update slug to link to first page in subsection
74
+ const subsectionItems = Object.entries(itemData).filter(([name, _data]) => name !== 'isSubsection');
75
+ const sortedSubsectionItems = subsectionItems.sort((
76
+ [name1, {sortValue: sortValue1 = 50}],
77
+ [name2, {sortValue: sortValue2 = 50}]
78
+ ) => {
79
+ if (sortValue1 === sortValue2) {
80
+ return name1.localeCompare(name2);
81
+ }
82
+ return sortValue1 > sortValue2 ? 1 : -1;
83
+ });
84
+ const firstSubsectionItem = sortedSubsectionItems[0];
85
+ slug = firstSubsectionItem[1].slug;
86
+ }
87
+
88
+ return {
89
+ idx,
90
+ slug,
91
+ itemName,
92
+ illustration,
93
+ isBeta,
94
+ title,
95
+ id,
96
+ galleryItemsData
97
+ };
98
+ });
99
+
100
+ return (
101
+ <div className={`ws-section-gallery${ isFullWidth ? ' ws-section-gallery-full-width' : '' }`}>
102
+ { children(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) }
103
+ </div>
104
+ )
105
+ };
@@ -1,21 +1,21 @@
1
- .ws-page-sidebar .pf-c-nav {
2
- --pf-c-nav__link--before--BorderBottomWidth: 0;
3
- --pf-c-nav--m-light__link--hover--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
4
- --pf-c-nav--m-light__link--focus--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
5
- --pf-c-nav--m-light__link--m-current--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
6
- --pf-c-nav--m-light__link--active--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
7
- --pf-c-nav__link--m-current--BackgroundColor: var(--pf-global--BackgroundColor--200);
1
+ .ws-page-sidebar .pf-v5-c-nav {
2
+ --pf-v5-c-nav__link--before--BorderBottomWidth: 0;
3
+ --pf-v5-c-nav--m-light__link--hover--BackgroundColor: var(--pf-v5-global--BackgroundColor--light-200);
4
+ --pf-v5-c-nav--m-light__link--focus--BackgroundColor: var(--pf-v5-global--BackgroundColor--light-200);
5
+ --pf-v5-c-nav--m-light__link--m-current--BackgroundColor: var(--pf-v5-global--BackgroundColor--light-200);
6
+ --pf-v5-c-nav--m-light__link--active--BackgroundColor: var(--pf-v5-global--BackgroundColor--light-200);
7
+ --pf-v5-c-nav__link--m-current--BackgroundColor: var(--pf-v5-global--BackgroundColor--200);
8
8
  }
9
9
 
10
- .ws-side-nav-list .pf-c-nav__item.pf-m-expandable::before {
10
+ .ws-side-nav-list .pf-v5-c-nav__item.pf-m-expandable::before {
11
11
  border-bottom: 0;
12
12
  }
13
13
 
14
- .pf-c-nav__subsection-title {
15
- color: var(--ws-toc-link--Color, var(--pf-global--Color--300));
16
- font-size: var(--pf-global--FontSize--sm);
14
+ .pf-v5-c-nav__subsection-title {
15
+ color: var(--ws-toc-link--Color, var(--pf-v5-global--Color--300));
16
+ font-size: var(--pf-v5-global--FontSize--sm);
17
17
  }
18
18
 
19
19
  #ws-sticky-nav-tabs {
20
- z-index: var(--pf-global--ZIndex--2xl);
20
+ z-index: var(--pf-v5-global--ZIndex--2xl);
21
21
  }