@patternfly/documentation-framework 1.2.70 → 1.3.1
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 +22 -0
- package/components/sideNav/sideNav.js +47 -27
- package/helpers/slugger.js +4 -1
- package/layouts/logo__pf--reverse--base.png +0 -0
- package/layouts/logo__pf--reverse--base.svg +40 -0
- package/layouts/logo__pf--reverse-on-md.svg +40 -0
- package/layouts/sideNavLayout/sideNavLayout.js +3 -3
- package/package.json +2 -2
- package/routes.js +42 -15
- package/scripts/md/parseMD.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.3.1 (2022-12-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **documentation-framework:** added local brand logos ([#3314](https://github.com/patternfly/patternfly-org/issues/3314)) ([bcf5efe](https://github.com/patternfly/patternfly-org/commit/bcf5efe27a7ed17bc92a6105eabb07fba9184ef0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 1.3.0 (2022-12-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **docs:** enabled tertiary nav in sidenav ([#3274](https://github.com/patternfly/patternfly-org/issues/3274)) ([b2a6804](https://github.com/patternfly/patternfly-org/commit/b2a6804d7d93026b3b3a7a7e06b53c51be998e1e))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## 1.2.70 (2022-12-07)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
@@ -3,10 +3,15 @@ import { Link } from '../link/link';
|
|
|
3
3
|
import { Nav, NavList, NavExpandable, PageContextConsumer, capitalize } from '@patternfly/react-core';
|
|
4
4
|
import { css } from '@patternfly/react-styles';
|
|
5
5
|
import { Location } from '@reach/router';
|
|
6
|
-
import {
|
|
6
|
+
import { makeSlug } from '../../helpers';
|
|
7
7
|
import globalBreakpointXl from "@patternfly/react-tokens/dist/esm/global_breakpoint_xl";
|
|
8
8
|
import { trackEvent } from '../../helpers';
|
|
9
9
|
|
|
10
|
+
const getIsActive = (location, section, subsection = null) => {
|
|
11
|
+
const slug = makeSlug(null, section, null, null, subsection);
|
|
12
|
+
return location.pathname.startsWith(`${process.env.pathPrefix}${slug}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
const NavItem = ({ text, href }) => {
|
|
11
16
|
const isMobileView = window.innerWidth < Number.parseInt(globalBreakpointXl.value, 10);
|
|
12
17
|
return (
|
|
@@ -34,6 +39,46 @@ const NavItem = ({ text, href }) => {
|
|
|
34
39
|
)
|
|
35
40
|
};
|
|
36
41
|
|
|
42
|
+
const ExpandableNav = ({groupedRoutes, location, section, subsection = null}) => {
|
|
43
|
+
const isActive = getIsActive(location, section, subsection);
|
|
44
|
+
const isSubsection = subsection;
|
|
45
|
+
const routes = isSubsection
|
|
46
|
+
? groupedRoutes[section][subsection]
|
|
47
|
+
: groupedRoutes[section];
|
|
48
|
+
const currentSection = isSubsection ? subsection : section;
|
|
49
|
+
const analyticsName = isSubsection ? `${section}/${subsection}` : section;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<NavExpandable
|
|
53
|
+
title={capitalize(currentSection.replace(/-/g, ' '))}
|
|
54
|
+
key={capitalize(currentSection.replace(/-/g, ' '))}
|
|
55
|
+
isActive={isActive}
|
|
56
|
+
isExpanded={isActive}
|
|
57
|
+
className="ws-side-nav-group"
|
|
58
|
+
onClick={(event) => {
|
|
59
|
+
// Don't bubble click event up, avoids subsection triggering duplicate analtics
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
// Don't trigger for bubbled events from NavItems
|
|
62
|
+
if (!event.target.href) {
|
|
63
|
+
const isExpanded = event.currentTarget.classList.contains('pf-m-expanded');
|
|
64
|
+
// 1 === expand section, 0 === collapse section
|
|
65
|
+
trackEvent('sidenav_section_click', 'click_event', analyticsName, isExpanded ? 0 : 1);
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{Object.entries(routes || {})
|
|
70
|
+
.filter(([id, { hideNavItem }]) => !Boolean(hideNavItem) && (id !== 'isSubsection'))
|
|
71
|
+
.map(([id, { slug, isSubsection = false }]) => ({ text: id, href: slug, isSubsection }))
|
|
72
|
+
.sort(({ text: text1 }, { text: text2 }) => text1.localeCompare(text2))
|
|
73
|
+
.map(navObj => navObj.isSubsection
|
|
74
|
+
? ExpandableNav({groupedRoutes, location, section, subsection: navObj.text})
|
|
75
|
+
: NavItem(navObj)
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
</NavExpandable>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
37
82
|
export const SideNav = ({ groupedRoutes = {}, navItems = [] }) => {
|
|
38
83
|
React.useEffect(() => {
|
|
39
84
|
if (typeof window === 'undefined') {
|
|
@@ -56,32 +101,7 @@ export const SideNav = ({ groupedRoutes = {}, navItems = [] }) => {
|
|
|
56
101
|
{navItems.map(({ section, text, href }) => section
|
|
57
102
|
? (
|
|
58
103
|
<Location key={section}>
|
|
59
|
-
{({ location }) => {
|
|
60
|
-
const isActive = location.pathname.startsWith(`${process.env.pathPrefix}/${slugger(section)}`);
|
|
61
|
-
return (
|
|
62
|
-
<NavExpandable
|
|
63
|
-
title={capitalize(section.replace(/-/g, ' '))}
|
|
64
|
-
isActive={isActive}
|
|
65
|
-
isExpanded={isActive}
|
|
66
|
-
className="ws-side-nav-group"
|
|
67
|
-
onClick={(event) => {
|
|
68
|
-
// Don't trigger for bubbled events from NavItems
|
|
69
|
-
if (!event.target.href) {
|
|
70
|
-
const isExpanded = event.currentTarget.classList.contains('pf-m-expanded');
|
|
71
|
-
// 1 === expand section, 0 === collapse section
|
|
72
|
-
trackEvent('sidenav_section_click', 'click_event', section, isExpanded ? 0 : 1);
|
|
73
|
-
}
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
{Object.entries(groupedRoutes[section] || {})
|
|
77
|
-
.filter(([, { hideNavItem }]) => !Boolean(hideNavItem))
|
|
78
|
-
.map(([id, { slug }]) => ({ text: id, href: slug }))
|
|
79
|
-
.sort(({ text: text1 }, { text: text2 }) => text1.localeCompare(text2))
|
|
80
|
-
.map(NavItem)
|
|
81
|
-
}
|
|
82
|
-
</NavExpandable>
|
|
83
|
-
);
|
|
84
|
-
}}
|
|
104
|
+
{({ location }) => ExpandableNav({groupedRoutes, location, section})}
|
|
85
105
|
</Location>
|
|
86
106
|
)
|
|
87
107
|
: NavItem({
|
package/helpers/slugger.js
CHANGED
|
@@ -11,11 +11,14 @@ const slugger = children => {
|
|
|
11
11
|
.replace(/[^A-Za-z0-9.\-~]/g, '');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const makeSlug = (source, section, id, noSource) => {
|
|
14
|
+
const makeSlug = (source, section, id, noSource, subsection) => {
|
|
15
15
|
let url = '';
|
|
16
16
|
|
|
17
17
|
if (section) {
|
|
18
18
|
url += `/${slugger(section)}`
|
|
19
|
+
if (subsection) {
|
|
20
|
+
url += `/${slugger(subsection)}`
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
if (id) {
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 188.4 17.2" style="enable-background:new 0 0 188.4 17.2;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{fill:#FFFFFF;}
|
|
7
|
+
.st1{fill:url(#SVGID_1_);}
|
|
8
|
+
</style>
|
|
9
|
+
<g>
|
|
10
|
+
<path class="st0" d="M26,14.3V3h4.8c0.7,0,1.3,0.1,1.8,0.3s0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.7,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
11
|
+
c0,0.3,0,0.5-0.1,0.8s-0.2,0.6-0.3,0.8c-0.1,0.3-0.3,0.5-0.5,0.7c-0.2,0.2-0.5,0.4-0.7,0.6c-0.3,0.2-0.6,0.3-1,0.4
|
|
12
|
+
s-0.8,0.1-1.2,0.1h-2.7V14L26,14.3L26,14.3z M30.9,8.1c0.3,0,0.5,0,0.7-0.1s0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.3-0.5
|
|
13
|
+
s0.1-0.4,0.1-0.5c0-0.2,0-0.3-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.3-0.5-0.4S31.3,5.2,31,5.2h-2.8v3L30.9,8.1L30.9,8.1z"
|
|
14
|
+
/>
|
|
15
|
+
<path class="st0" d="M49.7,14.3L48.8,12h-4.4l-0.8,2.3h-2.3L45.6,3h2.1L52,14.3H49.7z M47,7c-0.1-0.1-0.1-0.3-0.2-0.5
|
|
16
|
+
S46.7,6.1,46.6,6c0,0.2-0.1,0.3-0.2,0.5S46.3,6.9,46.2,7l-1.1,2.9H48L47,7z"/>
|
|
17
|
+
<path class="st0" d="M64.3,5.1v9.2h-2.2V5.1h-3.2V3h8.6v2.1H64.3z"/>
|
|
18
|
+
<path class="st0" d="M81.2,5.1v9.2H79V5.1h-3.2V3h8.6v2.1H81.2z"/>
|
|
19
|
+
<path class="st0" d="M93.4,14.3V3h7.7v2.1h-5.5v2.4h3.2v2.1h-3.2v2.7h5.9v2.1L93.4,14.3L93.4,14.3z"/>
|
|
20
|
+
<path class="st0" d="M110.6,14.3V3h5.2c0.7,0,1.3,0.1,1.8,0.3s0.9,0.5,1.2,0.8s0.5,0.7,0.6,1.1s0.2,0.9,0.2,1.3c0,0.3,0,0.6-0.1,1
|
|
21
|
+
c-0.1,0.3-0.2,0.6-0.4,0.9s-0.4,0.6-0.7,0.8c-0.3,0.2-0.6,0.4-1,0.6l2.2,4.5h-2.4l-2.1-4.2h-2.3v4.2H110.6z M115.8,8
|
|
22
|
+
c0.3,0,0.5,0,0.7-0.1s0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.2-0.5c0.1-0.2,0.1-0.4,0.1-0.6s0-0.4-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5
|
|
23
|
+
c-0.1-0.1-0.3-0.2-0.5-0.3s-0.4-0.1-0.7-0.1h-3.1V8H115.8L115.8,8L115.8,8z"/>
|
|
24
|
+
<path class="st0" d="M135.9,14.3l-4.5-6.6c-0.1-0.1-0.2-0.2-0.2-0.4C131.1,7.1,131,7,131,6.9c0,0.1,0,0.3,0,0.4c0,0.2,0,0.3,0,0.4
|
|
25
|
+
v6.6h-2.2V3h2l4.4,6.5c0.1,0.1,0.1,0.2,0.2,0.4c0.1,0.2,0.2,0.3,0.2,0.5c0-0.1,0-0.3,0-0.5s0-0.3,0-0.4V3h2.2v11.3H135.9
|
|
26
|
+
L135.9,14.3z"/>
|
|
27
|
+
<path class="st0" d="M147.6,14.3V3h7.6v2.1h-5.4v2.4h3.4v2.1h-3.4v4.8L147.6,14.3L147.6,14.3z"/>
|
|
28
|
+
<path class="st0" d="M164,14.3V3h2.2v9.2h5.4v2.1C171.6,14.3,164,14.3,164,14.3z"/>
|
|
29
|
+
<path class="st0" d="M182,14.3V9.9L177.8,3h2.5l2.8,4.6l2.8-4.6h2.5l-4.2,6.9v4.4H182z"/>
|
|
30
|
+
</g>
|
|
31
|
+
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="9.1034" y1="958.5184" x2="9.1034" y2="974.451" gradientTransform="matrix(1 0 0 1 0 -958)">
|
|
32
|
+
<stop offset="0" style="stop-color:#60EFFF"/>
|
|
33
|
+
<stop offset="1" style="stop-color:#1F89C7"/>
|
|
34
|
+
</linearGradient>
|
|
35
|
+
<path class="st1" d="M18.2,8.9L9.1,0L0,8.9L3.7,14l2.8-0.7l2.7,3.8l2.7-3.8l2.7,0.6L18.2,8.9z M8.7,1.7L7.6,12.6L5.3,9.5L8.7,1.7z
|
|
36
|
+
M5,9.1L3.7,7.2l4.8-5.9L5,9.1z M7.2,12.6L7.2,12.6l0.1,0.2L6.6,13l-1.7-2.4l0.3-0.7L7.2,12.6z M9.1,1.5l1.2,11.6l-1.2,1.6L8,13.1
|
|
37
|
+
L9.1,1.5z M11,12.6l2.1-2.8l0.3,0.7L11.7,13l-0.8-0.2L11,12.6L11,12.6z M10.7,12.6L9.5,1.7l3.4,7.8L10.7,12.6z M9.8,1.3l4.8,5.9
|
|
38
|
+
l-1.4,1.9L9.8,1.3z M3.8,13.6L0.5,9L7,2.6L3.2,7.2l1.7,2.3l-0.5,1.1l1.8,2.5L3.8,13.6z M9.1,16.6l-2.3-3.3l0.7-0.2l1.6,2.2l1.6-2.2
|
|
39
|
+
l0.8,0.2L9.1,16.6z M12.1,13.1l1.8-2.5l-0.5-1.1L15,7.3l-3.8-4.6L17.7,9l-3.3,4.7L12.1,13.1z"/>
|
|
40
|
+
</svg>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 220 40" style="enable-background:new 0 0 220 40;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{fill:#FFFFFF;}
|
|
7
|
+
.st1{fill:url(#SVGID_1_);}
|
|
8
|
+
</style>
|
|
9
|
+
<g>
|
|
10
|
+
<path class="st0" d="M56.4,25.7V14.4h4.8c0.7,0,1.3,0.1,1.8,0.3s0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.7,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
11
|
+
c0,0.3,0,0.5-0.1,0.8s-0.2,0.6-0.3,0.8c-0.1,0.3-0.3,0.5-0.5,0.7c-0.2,0.2-0.5,0.4-0.7,0.6c-0.3,0.2-0.6,0.3-1,0.4
|
|
12
|
+
s-0.8,0.1-1.2,0.1h-2.7v4.1L56.4,25.7L56.4,25.7z M61.3,19.5c0.3,0,0.5,0,0.7-0.1s0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.3-0.5
|
|
13
|
+
s0.1-0.4,0.1-0.5c0-0.2,0-0.3-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.3-0.5-0.4s-0.4-0.1-0.7-0.1h-2.8v3L61.3,19.5
|
|
14
|
+
L61.3,19.5z"/>
|
|
15
|
+
<path class="st0" d="M80.1,25.7l-0.9-2.3h-4.4L74,25.7h-2.3L76,14.4h2.1l4.3,11.3H80.1z M77.4,18.4c-0.1-0.1-0.1-0.3-0.2-0.5
|
|
16
|
+
s-0.1-0.4-0.2-0.5c0,0.2-0.1,0.3-0.2,0.5s-0.1,0.4-0.2,0.5l-1.1,2.9h2.9L77.4,18.4z"/>
|
|
17
|
+
<path class="st0" d="M94.7,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H94.7z"/>
|
|
18
|
+
<path class="st0" d="M111.6,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H111.6z"/>
|
|
19
|
+
<path class="st0" d="M123.8,25.7V14.4h7.7v2.1H126v2.4h3.2V21H126v2.7h5.9v2.1L123.8,25.7L123.8,25.7z"/>
|
|
20
|
+
<path class="st0" d="M141,25.7V14.4h5.2c0.7,0,1.3,0.1,1.8,0.3s0.9,0.5,1.2,0.8s0.5,0.7,0.6,1.1s0.2,0.9,0.2,1.3c0,0.3,0,0.6-0.1,1
|
|
21
|
+
c-0.1,0.3-0.2,0.6-0.4,0.9s-0.4,0.6-0.7,0.8c-0.3,0.2-0.6,0.4-1,0.6l2.2,4.5h-2.4l-2.1-4.2h-2.3v4.2H141z M146.2,19.4
|
|
22
|
+
c0.3,0,0.5,0,0.7-0.1s0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.2-0.5c0.1-0.2,0.1-0.4,0.1-0.6s0-0.4-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5
|
|
23
|
+
c-0.1-0.1-0.3-0.2-0.5-0.3s-0.4-0.1-0.7-0.1h-3.1v2.9H146.2L146.2,19.4L146.2,19.4z"/>
|
|
24
|
+
<path class="st0" d="M166.3,25.7l-4.5-6.6c-0.1-0.1-0.2-0.2-0.2-0.4c-0.1-0.2-0.2-0.3-0.2-0.4c0,0.1,0,0.3,0,0.4c0,0.2,0,0.3,0,0.4
|
|
25
|
+
v6.6h-2.2V14.4h2l4.4,6.5c0.1,0.1,0.1,0.2,0.2,0.4c0.1,0.2,0.2,0.3,0.2,0.5c0-0.1,0-0.3,0-0.5s0-0.3,0-0.4v-6.5h2.2v11.3H166.3
|
|
26
|
+
L166.3,25.7z"/>
|
|
27
|
+
<path class="st0" d="M178,25.7V14.4h7.6v2.1h-5.4v2.4h3.4V21h-3.4v4.8L178,25.7L178,25.7z"/>
|
|
28
|
+
<path class="st0" d="M194.4,25.7V14.4h2.2v9.2h5.4v2.1C202,25.7,194.4,25.7,194.4,25.7z"/>
|
|
29
|
+
<path class="st0" d="M212.4,25.7v-4.4l-4.2-6.9h2.5l2.8,4.6l2.8-4.6h2.5l-4.2,6.9v4.4H212.4z"/>
|
|
30
|
+
</g>
|
|
31
|
+
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="20.95" y1="959.3931" x2="20.95" y2="996.0593" gradientTransform="matrix(1 0 0 1 0 -958)">
|
|
32
|
+
<stop offset="0" style="stop-color:#60EFFF"/>
|
|
33
|
+
<stop offset="1" style="stop-color:#1F89C7"/>
|
|
34
|
+
</linearGradient>
|
|
35
|
+
<path class="st1" d="M41.9,20.7L21,0.2L0,20.7l8.4,11.8l6.4-1.5l6.3,8.8l6.3-8.8l6.3,1.4L41.9,20.7z M20.1,4l-2.7,25.1L12.2,22
|
|
36
|
+
L20.1,4z M11.6,21.2l-3.2-4.4L19.5,3.3L11.6,21.2z M16.5,29.3L16.5,29.3l0.3,0.4l-1.7,0.4l-4-5.6l0.7-1.6L16.5,29.3z M21,3.7
|
|
37
|
+
l2.7,26.6L21,34l-2.7-3.7L21,3.7z M25.4,29.3l4.8-6.5l0.7,1.7l-4,5.6l-1.8-0.4L25.4,29.3L25.4,29.3z M24.6,29.1L21.9,4l7.9,18
|
|
38
|
+
L24.6,29.1z M22.5,3.3l11,13.5l-3.2,4.3L22.5,3.3z M8.7,31.6L1.1,20.8L16,6.2L7.3,16.8l3.9,5.3l-1.1,2.5l4.1,5.7L8.7,31.6z M21,38.5
|
|
39
|
+
l-5.4-7.6l1.7-0.4l3.6,5l3.6-5l1.8,0.4L21,38.5z M27.8,30.4l4.1-5.7l-1.1-2.6l3.8-5.2L25.9,6.2l14.9,14.6l-7.6,10.8L27.8,30.4z"/>
|
|
40
|
+
</svg>
|
|
@@ -28,9 +28,9 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
|
28
28
|
import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';
|
|
29
29
|
import { SideNav, TopNav, GdprBanner } from '../../components';
|
|
30
30
|
import staticVersions from '../../versions.json';
|
|
31
|
-
import logoMd from '
|
|
32
|
-
import logo from '
|
|
33
|
-
import logoBase from '
|
|
31
|
+
import logoMd from '../logo__pf--reverse-on-md.svg';
|
|
32
|
+
import logo from '../logo__pf--reverse--base.svg';
|
|
33
|
+
import logoBase from '../logo__pf--reverse--base.png';
|
|
34
34
|
|
|
35
35
|
const HeaderTools = ({
|
|
36
36
|
versions,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"react": "^16.8.0 || ^17.0.0",
|
|
86
86
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "f4d5845c294a2b7d0d510320e3e086b0b2f9b90f"
|
|
89
89
|
}
|
package/routes.js
CHANGED
|
@@ -28,20 +28,34 @@ const isNull = o => o === null || o === undefined;
|
|
|
28
28
|
const groupedRoutes = Object.entries(routes)
|
|
29
29
|
.filter(([_slug, { id, section }]) => !isNull(id) && !isNull(section))
|
|
30
30
|
.reduce((accum, [slug, pageData]) => {
|
|
31
|
-
const { section, id, title, source, katacodaLayout, hideNavItem } = pageData;
|
|
31
|
+
const { section, subsection = null, id, title, source, katacodaLayout, hideNavItem } = pageData;
|
|
32
|
+
pageData.slug = slug;
|
|
33
|
+
// add section to groupedRoutes obj if not yet created
|
|
32
34
|
accum[section] = accum[section] || {};
|
|
33
|
-
|
|
35
|
+
// define data for page to be added to groupedRoutes obj
|
|
36
|
+
const data = {
|
|
34
37
|
id,
|
|
35
38
|
section,
|
|
39
|
+
subsection,
|
|
36
40
|
title,
|
|
37
|
-
slug: makeSlug(source, section, id, true),
|
|
41
|
+
slug: makeSlug(source, section, id, true, subsection),
|
|
38
42
|
sources: [],
|
|
39
43
|
katacodaLayout,
|
|
40
44
|
hideNavItem
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
}
|
|
46
|
+
// add page to groupedRoutes obj section or subsection
|
|
47
|
+
if (subsection) {
|
|
48
|
+
// add subsection to section
|
|
49
|
+
accum[section][subsection] = accum[section][subsection] || {};
|
|
50
|
+
accum[section][subsection].isSubsection = true;
|
|
51
|
+
// add page to subsection
|
|
52
|
+
accum[section][subsection][id] = accum[section][subsection][id] || data;
|
|
53
|
+
accum[section][subsection][id].sources.push(pageData);
|
|
54
|
+
} else {
|
|
55
|
+
// add page to section
|
|
56
|
+
accum[section][id] = accum[section][id] || data;
|
|
57
|
+
accum[section][id].sources.push(pageData);
|
|
58
|
+
}
|
|
45
59
|
|
|
46
60
|
return accum;
|
|
47
61
|
}, {});
|
|
@@ -88,15 +102,28 @@ const getDefaultDesignGuidelines = ({ id, section, slug, title }) => {
|
|
|
88
102
|
Object.entries(groupedRoutes)
|
|
89
103
|
.forEach(([_section, ids]) => {
|
|
90
104
|
Object.values(ids).forEach(pageData => {
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
pageData.
|
|
94
|
-
|
|
105
|
+
let pageDataArr = [];
|
|
106
|
+
// Loop through each page in expandable subsection
|
|
107
|
+
if (pageData.isSubsection) {
|
|
108
|
+
Object.entries(pageData).map(([section, ids]) => {
|
|
109
|
+
if (section !== 'isSubsection') {
|
|
110
|
+
pageDataArr.push(ids);
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
} else {
|
|
114
|
+
pageDataArr = [pageData];
|
|
115
|
+
}
|
|
116
|
+
pageDataArr.forEach(pageDataObj => {
|
|
117
|
+
const { slug } = pageDataObj;
|
|
118
|
+
// Remove source routes for `app.js`
|
|
119
|
+
pageDataObj.sources.forEach(({ slug }) => {
|
|
120
|
+
delete routes[slug];
|
|
121
|
+
});
|
|
122
|
+
// Sort sources for tabs
|
|
123
|
+
pageDataObj.sources = pageDataObj.sources.sort(sortSources);
|
|
124
|
+
// Add grouped route
|
|
125
|
+
routes[slug] = pageDataObj;
|
|
95
126
|
});
|
|
96
|
-
// Sort sources for tabs
|
|
97
|
-
pageData.sources = pageData.sources.sort(sortSources);
|
|
98
|
-
// Add grouped route
|
|
99
|
-
routes[slug] = pageData;
|
|
100
127
|
})
|
|
101
128
|
});
|
|
102
129
|
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -49,7 +49,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
49
49
|
file.fail('id attribute is required in frontmatter for PatternFly docs');
|
|
50
50
|
}
|
|
51
51
|
source = frontmatter.source || source;
|
|
52
|
-
const slug = makeSlug(source, frontmatter.section, frontmatter.id);
|
|
52
|
+
const slug = makeSlug(source, frontmatter.section, frontmatter.id, false, frontmatter.subsection);
|
|
53
53
|
outPath = path.join(outputBase, `${slug}.js`);
|
|
54
54
|
|
|
55
55
|
let sourceRepo = 'patternfly-org';
|
|
@@ -80,6 +80,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
80
80
|
pageData = {
|
|
81
81
|
id: frontmatter.id,
|
|
82
82
|
section: frontmatter.section || '',
|
|
83
|
+
subsection: frontmatter.subsection || '',
|
|
83
84
|
source,
|
|
84
85
|
slug,
|
|
85
86
|
sourceLink: `https://github.com/patternfly/${
|
|
@@ -92,7 +93,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
92
93
|
// Temporarily override section until https://github.com/patternfly/patternfly-react/pull/4862 is in react-docs
|
|
93
94
|
pageData.section = 'components';
|
|
94
95
|
pageData.source = `${source}-demos`;
|
|
95
|
-
pageData.slug = makeSlug(pageData.source, pageData.section, pageData.id);
|
|
96
|
+
pageData.slug = makeSlug(pageData.source, pageData.section, pageData.id, false, pageData.subsection);
|
|
96
97
|
outPath = path.join(outputBase, `${pageData.slug}.js`);
|
|
97
98
|
}
|
|
98
99
|
if (frontmatter.title) {
|
|
@@ -259,6 +260,7 @@ function sourceMDFile(file, source, buildMode) {
|
|
|
259
260
|
...(pageData.examples && { examples: pageData.examples }),
|
|
260
261
|
...(pageData.fullscreenExamples && { fullscreenExamples: pageData.fullscreenExamples }),
|
|
261
262
|
section: pageData.section,
|
|
263
|
+
subsection: pageData.subsection,
|
|
262
264
|
source: pageData.source,
|
|
263
265
|
...(pageData.katacodaLayout && { katacodaLayout: pageData.katacodaLayout }),
|
|
264
266
|
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
|