Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
2f1f281
feat(docs): added component description to header above tabs
evwilkin Aug 15, 2022
245cc31
feat(docs): added component description to header above tabs
evwilkin Aug 15, 2022
cc116a5
set up components-info.json, pass to webpack.base.config
evwilkin Aug 16, 2022
da3ea7f
pass componentInfo to example.js
evwilkin Aug 16, 2022
63e1a07
working except for Links in mdx to avoid anchor tags
evwilkin Aug 19, 2022
06c6fe2
update naming - image to illustration
evwilkin Aug 19, 2022
6b7d3e7
revert to dangerouslySetInnerHTML
evwilkin Aug 19, 2022
36b9547
convert string to JSX to maintain router links
evwilkin Aug 22, 2022
4e5705f
remove word doc
evwilkin Aug 23, 2022
d71544a
reapply tile fix
evwilkin Aug 23, 2022
a283bdb
clean up logic to avoid undefined errors
evwilkin Aug 23, 2022
f6c5aa1
fix form select & multiple file upload summaries
evwilkin Aug 24, 2022
4374233
Merge remote-tracking branch 'upstream/main' into feat/2989-component…
evwilkin Aug 24, 2022
57046d1
sort View all components to top of components sidenav
evwilkin Aug 24, 2022
2667cc2
added component gallery
evwilkin Aug 24, 2022
d327c93
rebase on main
evwilkin Aug 27, 2022
7de2629
pull in component summary, illustration link
evwilkin Sep 1, 2022
1344d3f
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Sep 6, 2022
e21d5e3
illustrations working, moved to v4
evwilkin Sep 7, 2022
bccf2bb
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Sep 7, 2022
4ab3c43
insert toolbar & item count
evwilkin Sep 8, 2022
3366661
feat(docs): add component gallery
evwilkin Sep 13, 2022
18c9f65
rebased
evwilkin Sep 13, 2022
9c87470
increase toolbar width to offset pulling it left
evwilkin Sep 13, 2022
d961aeb
add optional chaining and default values for drawerPanelData
evwilkin Sep 13, 2022
05d487f
add reset button in place of searchinput clear button
evwilkin Sep 13, 2022
63eacbd
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Sep 19, 2022
2bd0086
design feedback & css styling
evwilkin Sep 27, 2022
aeed053
responsive
evwilkin Sep 27, 2022
eb25ef1
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Sep 28, 2022
dd3980b
remove unused code, fix sticky top on mobile
evwilkin Oct 2, 2022
92c719d
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Oct 2, 2022
9d37d53
rebase on main
evwilkin Oct 7, 2022
25522cf
PR feedback 1
evwilkin Oct 11, 2022
43970f0
gallery container sizing and spacing, default image
evwilkin Nov 1, 2022
1929581
coker feedback, refactor toolbar & fix search interaction
evwilkin Nov 1, 2022
e9aa390
rebased
evwilkin Nov 1, 2022
fb7e8d6
fix hide sidebar based on search results
evwilkin Nov 1, 2022
a19d579
persistent sidebar
evwilkin Nov 3, 2022
5b75a7a
add list view
evwilkin Nov 3, 2022
64e3929
remove sidebar, add beta labels, click to navigate
evwilkin Nov 11, 2022
4cee692
data list max-width
evwilkin Nov 11, 2022
bf0d116
fix toolbar z-index, refactor duplicate code
evwilkin Nov 11, 2022
1bb02a8
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Nov 11, 2022
3c9cdfc
fix duplicate summary due to incorrect rebase
evwilkin Nov 11, 2022
ffaabd8
Fix surge links?
evwilkin Nov 11, 2022
bbab9bf
moving code into doc-framework
evwilkin Nov 14, 2022
4ba8d67
Merge remote-tracking branch 'upstream/main' into feat/2992-view-all-…
evwilkin Nov 23, 2022
df1bd25
add alias for v4 component images in doc-framework webpack base config
evwilkin Jan 5, 2023
940ac83
remove link styling, nested links, beta labels on next components
evwilkin Jan 5, 2023
1f9f112
rebased
evwilkin Feb 6, 2023
40d02e1
adding hasOverview field to trigger gallery view
evwilkin Feb 8, 2023
6902fdd
changes to tooltip guidelines (#3400)
tiyiprh Feb 9, 2023
37ad6e0
chore(release): releasing packages [ci skip]
patternfly-build Feb 9, 2023
093c6c7
feat(docs): customize tabs with optional tabText frontmatter (#3394)
evwilkin Feb 9, 2023
a9a48b1
chore(release): releasing packages [ci skip]
patternfly-build Feb 9, 2023
b630ed9
feat(docs): enabled manual ordering of sidenav (#3403)
evwilkin Feb 9, 2023
473ad93
chore(release): releasing packages [ci skip]
patternfly-build Feb 9, 2023
0294ebd
fix(whitespace): test github actions
nicolethoen Feb 13, 2023
138065a
add action guidance (#3347)
mmenestr Feb 20, 2023
40d1a8a
chore(release): releasing packages [ci skip]
patternfly-build Feb 20, 2023
a8dee99
feat(trainings): remove broken trainings and replace some with blog s…
nicolethoen Feb 27, 2023
8efb032
chore(release): releasing packages [ci skip]
patternfly-build Feb 27, 2023
ac6752c
docs(Badge): Small typo in a11y section (#3405)
Venefilyn Feb 27, 2023
7a23c00
chore(release): releasing packages [ci skip]
patternfly-build Feb 27, 2023
d52628e
Updates colors guideline content. (#3233)
edonehoo Mar 1, 2023
6987bc9
chore(release): releasing packages [ci skip]
patternfly-build Mar 1, 2023
f3eb5bf
feat(docs): add react console documentation (#3366)
wise-king-sullyman Mar 1, 2023
2f21780
chore(release): releasing packages [ci skip]
patternfly-build Mar 1, 2023
39a2852
chore: remove hard coded GA ID (#3431)
evwilkin Mar 2, 2023
ee80668
chore(release): releasing packages [ci skip]
patternfly-build Mar 2, 2023
d06eb61
fix(menu): update and clarify description (#3438)
nicolethoen Mar 8, 2023
78bd2ec
chore(release): releasing packages [ci skip]
patternfly-build Mar 8, 2023
3ede0ff
fix search params, remove hasOverview code
evwilkin Mar 9, 2023
050bf7f
rebased
evwilkin Mar 10, 2023
3cf517c
Move page .md from docs-framework to v4
evwilkin Mar 10, 2023
fc40798
fixed placement of beta labels
evwilkin Mar 10, 2023
434a84f
split gallery page into composable components
evwilkin Mar 11, 2023
a58a044
added customizable text, documented params
evwilkin Mar 15, 2023
31d3f7d
merge rebased v5 into PR
evwilkin Apr 10, 2023
9b6915a
Merge remote-tracking branch 'upstream/v5' into feat/2992-view-all-co…
evwilkin Apr 11, 2023
90525d5
Merge remote-tracking branch 'upstream/v5' into feat/2992-view-all-co…
evwilkin Apr 12, 2023
709487e
fixed toolbar width
evwilkin Apr 12, 2023
12b7d8b
moved .md file to pages directory
evwilkin Apr 12, 2023
1b0e26d
move gallery page, remove hideSourceTabs
evwilkin Apr 12, 2023
02eb98a
updated to enable toggling of subsection parsing
evwilkin Apr 13, 2023
585ca9f
update & comment CSS
evwilkin Apr 13, 2023
b07a9b7
Merge remote-tracking branch 'upstream/v5' into feat/2992-view-all-co…
evwilkin Apr 13, 2023
3aee511
Merge branch 'v5' into feat/2992-view-all-components
nicolethoen Apr 18, 2023
bd8cb88
updates per comments
nicolethoen Apr 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from "react";
import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCell, Split, SplitItem, TextContent, Text, TextVariants, Label } from "@patternfly/react-core";
import { Link } from '../link/link';
import { convertToReactComponent } from "@patternfly/ast-helpers";

// convert summary text in drawer from string to jsx
const SummaryComponent = ({ id, itemsData }) => {
const itemDasherized = id.split(' ').join('-').toLowerCase();
const summary = itemsData?.[itemDasherized]?.summary;
if (!summary) {
return null;
}
// Remove anchor tags to avoid <a> in summary nested within <a> of Link card/datalistitem
const summaryNoLinks = summary.replace(/<Link[^>]*>([^<]+)<\/Link>/gm, '$1');
const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`);
const getSummaryComponent = new Function('React', code);
return getSummaryComponent(React);
}

export const SectionDataListLayout = ({ galleryItems, layoutView }) => {
if (layoutView !== 'list') {
return null;
}

return (
<DataList onSelectDataListItem={() => {}}>
{galleryItems.map(({ idx, slug, illustration, itemName, title, isBeta, id, galleryItemsData }) => (
<Link to={slug} key={idx} className="ws-section-gallery-item">
<DataListItem>
<DataListItemRow>
<DataListItemCells dataListCells={[
<DataListCell width={1} key="illustration">
{illustration && (
<div>
<img src={illustration} alt={`${itemName} illustration`} />
</div>
)}
</DataListCell>,
<DataListCell width={5} key="text-description">
<Split className="pf-u-mb-md">
<SplitItem isFilled>
<TextContent>
<Text component={TextVariants.h2}>
<span>
{title}
</span>
</Text>
</TextContent>
</SplitItem>
<SplitItem>
{isBeta && <Label color="gold">Beta feature</Label>}
</SplitItem>
</Split>
<TextContent>
<Text>
{ id ? <SummaryComponent id={id} itemsData={galleryItemsData} /> : null }
</Text>
</TextContent>
</DataListCell>
]} />
</DataListItemRow>
</DataListItem>
</Link>
))}
</DataList>
)
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
..ws-mdx-content-content {
max-width: initial !important;
}

.ws-section-gallery {
/* top placement */
margin-top: calc(var(--pf-c-page__main-section--PaddingTop) * -1);
}

/* Toolbar styles */
.ws-section-gallery .pf-c-toolbar {
margin-left: calc(var(--pf-c-page__main-section--PaddingLeft) * -1);
border-bottom: var(--pf-c-page__sidebar--m-light--BorderRightWidth) solid var(--pf-c-page__sidebar--m-light--BorderRightColor);
margin-bottom: var(--pf-global--spacer--md);
width: calc(100% + var(--pf-c-page__main-section--PaddingLeft) + var(--pf-c-page__main-section--PaddingRight));
/* avoid hoverable data list items overlapping toolbar */
z-index: calc(var(--pf-global--ZIndex--xs) + 2);
}

/* Match toolbar left-padding to gallery left-padding */
.ws-section-gallery .pf-c-toolbar .pf-c-toolbar__content {
--pf-c-toolbar__content--PaddingLeft: var(--pf-c-page__main-section--PaddingLeft);
}

/* Avoid toolbar wrap on smaller screens */
.ws-section-gallery .pf-c-toolbar__content-section {
flex-wrap: nowrap;
}

/* Avoid link styling on gallery/data list item names */
.ws-section-gallery-item {
text-decoration: inherit;
color: inherit;
}

/* Ensure same height for all cards in a gallery row */
.ws-section-gallery .pf-c-card {
height: 100%;
}

/* Limit width for data list view only */
.ws-section-gallery .pf-c-data-list {
max-width: 956px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from "react";

import './sectionGallery.css';
import { SectionGalleryToolbar } from "./sectionGalleryToolbar";
import { SectionGalleryLayout } from "./sectionGalleryLayout";
import { SectionDataListLayout } from "./sectionDataListLayout";
import { SectionGalleryWrapper } from "./sectionGalleryWrapper";

/**
* Helper component returns gallery of items with search toolbar and switchable gallery/data list views.
* @param {Object} illustrations - Object of preview images mapped to their snake_case item display name
* @param {string} section - Name of the navigation section to create the gallery within
* @param {Object} galleryItemsData - Object containing the image location & summary text mapped to the gallery item's hyphenated-name
* @param {string} [placeholderText=Search by name] - Optional text to be displayed as placeholder for SearchInput
* @param {string} [countText= items] - Optional text to be displayed after the number of search results
*/

export const SectionGallery = ({
illustrations,
section,
subsection = null,
includeSubsections = false,
parseSubsections = false,
galleryItemsData,
placeholderText,
countText
}) => (
<SectionGalleryWrapper
illustrations={illustrations}
section={section}
subsection={subsection}
includeSubsections={includeSubsections}
parseSubsections={parseSubsections}
galleryItemsData={galleryItemsData}
>
{(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) => {
return (
<>
<SectionGalleryToolbar
galleryItems={sectionGalleryItems}
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
layoutView={layoutView}
setLayoutView={setLayoutView}
placeholderText={placeholderText}
countText={countText}
/>
<SectionGalleryLayout galleryItems={sectionGalleryItems} layoutView={layoutView} />
<SectionDataListLayout galleryItems={sectionGalleryItems} layoutView={layoutView} />
</>
)}}
</SectionGalleryWrapper>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import { Gallery, GalleryItem, Card, CardTitle, CardBody, CardFooter, Label } from "@patternfly/react-core";
import { Link } from '../link/link';

export const SectionGalleryLayout = ({ galleryItems, layoutView }) => {
if (layoutView !== 'grid') {
return null;
}

return (
<Gallery hasGutter>
{galleryItems.map(({idx, slug, id, itemName, illustration, isBeta}) => (
<GalleryItem span={4} key={idx}>
<Link to={slug} className="ws-section-gallery-item">
<Card
id={id}
key={idx}
isSelectableRaised
>
<CardTitle>{itemName}</CardTitle>
{illustration && (
<CardBody>
<img src={illustration} alt={`${itemName} illustration`} />
</CardBody>
)}
{isBeta && (
<CardFooter>
<Label color="blue">Beta feature</Label>
</CardFooter>
)}
</Card>
</Link>
</GalleryItem>
))}
</Gallery>
)
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import { Button, SearchInput, Toolbar, ToolbarContent, ToolbarGroup, ToolbarItem, Text, TextVariants, ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
import ListIcon from '@patternfly/react-icons/dist/esm/icons/list-icon';
import ThIcon from'@patternfly/react-icons/dist/esm/icons/th-icon';

export const SectionGalleryToolbar = ({ galleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView, placeholderText ="Search by name", countText=" items" }) => (
<Toolbar isSticky>
<ToolbarContent>
<ToolbarItem variant="search-filter" widths={{default: '100%', md: '320px'}}>
<SearchInput onClear={false} value={searchTerm} placeholder={placeholderText} onChange={(_evt, val) => setSearchTerm(val)} />
</ToolbarItem>
{searchTerm && (
<ToolbarItem>
<Button variant="link" onClick={() => setSearchTerm('')}>Reset</Button>
</ToolbarItem>
)}
<ToolbarGroup variant="icon-button-group">
<ToolbarItem>
<ToggleGroup>
<ToggleGroupItem icon={<ThIcon />} aria-label="grid icon button" isSelected={layoutView === 'grid'} onChange={() => setLayoutView('grid')}></ToggleGroupItem>
<ToggleGroupItem icon={<ListIcon />} aria-label="list icon button" isSelected={layoutView === 'list'} onChange={() => setLayoutView('list')}></ToggleGroupItem>
</ToggleGroup>
</ToolbarItem>
</ToolbarGroup>
<ToolbarItem variant="pagination" spacer={{default: 'spacerMd', md: 'spacerNone'}} style={{'--pf-c-toolbar__item--MinWidth': "max-content"}}>
<Text component={TextVariants.small}>{ galleryItems.length }{ countText }</Text>
</ToolbarItem>
</ToolbarContent>
</Toolbar>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import React from "react";
import { groupedRoutes } from '../../routes';

export const SectionGalleryWrapper = ({section, subsection, galleryItemsData, illustrations, includeSubsections, parseSubsections, children }) => {
let sectionRoutes = subsection ? groupedRoutes[section][subsection] : groupedRoutes[section];
if (!includeSubsections || parseSubsections) {
const sectionRoutesArr = Object.entries(sectionRoutes);
// loop through galleryItems object and build new object to handle subsections
sectionRoutes = sectionRoutesArr.reduce((acc, [navName, routeData]) => {
// exit immediately if current item is isSubsection flag
if (navName === 'isSubsection') {
return acc;
}
// add current item
if (includeSubsections || !routeData.isSubsection) {
acc[navName] = routeData;
}
// drill down into current item if subsection and parseSubsections === true
if (parseSubsections && routeData.isSubsection) {
// loop through each subsection item & add
Object.entries(routeData).map(([subitemName, subitemData]) => {
if (subitemName !== 'isSubsection') {
acc[subitemName] = subitemData;
}
})
}
return acc;
}, {})
}

const [searchTerm, setSearchTerm] = React.useState('');
const [layoutView, setLayoutView] = React.useState('grid');
const filteredItems = Object.entries(sectionRoutes)
.filter(([itemName, { slug }]) => (
// exclude current gallery page from results
slug !== location.pathname &&
itemName
.toLowerCase()
.includes(searchTerm.toLowerCase())
));
const sectionGalleryItems = filteredItems
.sort(([itemName1], [itemName2]) => itemName1.localeCompare(itemName2))
.map(([itemName, itemData], idx) => {
// Convert to lowercase-camelcase ex: File upload - multiple ==> file_upload_multiple
const illustrationName = itemName
.replace('-', '')
.replace(' ',' ')
.split(' ')
.join('_')
.toLowerCase();
const illustration = illustrations[illustrationName] || illustrations.default_placeholder;
const { title, id, sources, isSubsection = false } = itemData;
// Display beta label if tab other than a '-next' tab is marked Beta
const isBeta = !isSubsection && sources && sources.some(src => src.beta && !src.source.includes('-next'));
let slug = itemData.slug;
if (!slug && isSubsection) {
// Update slug to link to first page in subsection
const subsectionItems = Object.entries(itemData).filter(([name, _data]) => name !== 'isSubsection');
const sortedSubsectionItems = subsectionItems.sort((
[name1, {sortValue: sortValue1 = 50}],
[name2, {sortValue: sortValue2 = 50}]
) => {
if (sortValue1 === sortValue2) {
return name1.localeCompare(name2);
}
return sortValue1 > sortValue2 ? 1 : -1;
});
const firstSubsectionItem = sortedSubsectionItems[0];
slug = firstSubsectionItem[1].slug;
}

return {
idx,
slug,
itemName,
illustration,
isBeta,
title,
id,
galleryItemsData
};
});

return (
<div className="ws-section-gallery">
{ children(sectionGalleryItems, searchTerm, setSearchTerm, layoutView, setLayoutView) }
</div>
)
};
1 change: 1 addition & 0 deletions packages/documentation-framework/scripts/md/parseMD.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ function sourceMDFile(file, source, buildMode) {
source: pageData.source,
tabName: pageData.tabName,
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem }),
...(pageData.beta && { beta: pageData.beta }),
...(pageData.sortValue && { sortValue: pageData.sortValue }),
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ module.exports = (_env, argv) => {
'process.env.sideNavItems': JSON.stringify(sideNavItems),
'process.env.topNavItems': JSON.stringify(topNavItems),
'process.env.prnum': JSON.stringify(process.env.CIRCLE_PR_NUMBER || process.env.PR_NUMBER || ''),
'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || ''),
'process.env.prurl': JSON.stringify(process.env.CIRCLE_PULL_REQUEST || '')
}),
new CopyWebpackPlugin({
patterns: [
Expand Down
Loading