Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update styling for v6 #303

Merged
merged 11 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
4 changes: 2 additions & 2 deletions packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"serve": "serve public"
},
"dependencies": {
"@patternfly/patternfly": "6.0.0-alpha.139",
"@patternfly/patternfly": "6.0.0-alpha.160",
"@patternfly/quickstarts": "^6.0.0-alpha.0",
"@patternfly/react-core": "6.0.0-alpha.61",
"@patternfly/react-core": "6.0.0-alpha.74",
"i18next": "^19.8.3",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-parser": "^9.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/dev/src/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
console.log(allQuickStartStates);
}, [allQuickStartStates]);


const language = localStorage.getItem('bridge/language') || 'en';
const resourceBundle = i18n.getResourceBundle(language, 'quickstart');

Expand All @@ -56,7 +55,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
{yamlQuickStarts && yamlQuickStarts.length ? (
<QuickStartContextProvider value={valuesForQuickstartContext}>
<QuickStartDrawer>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
<Page masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar>
{children}
</Page>
</QuickStartDrawer>
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/AppHelpTopicDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const AppHelpTopicDemo: React.FC<AppProps> = ({ children }) => {
return (
<React.Suspense fallback={<LoadingBox />}>
<HelpTopicContainer {...helpTopicContainerProps}>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
<Page masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar>
{children}
</Page>
</HelpTopicContainer>
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/AppLocalized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const App3: React.FC<AppProps> = ({ children, showCardFooters }) => {
return (
<React.Suspense fallback={<LoadingBox />}>
<QuickStartContainer {...drawerProps}>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
<Page masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar>
{children}
</Page>
</QuickStartContainer>
Expand Down
4 changes: 1 addition & 3 deletions packages/dev/src/AppProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
console.log(allQuickStartStates);
}, [allQuickStartStates]);



const withQueryParams = true;

const drawerProps: QuickStartContainerProps = {
Expand Down Expand Up @@ -81,7 +79,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
return (
<React.Suspense fallback={<LoadingBox />}>
<QuickStartContainer {...drawerProps}>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
<Page masthead={AppHeader} sidebar={AppSidebar} isManagedSidebar>
<Button
variant="secondary"
onClick={() => toggleQuickStart('getting-started-with-quick-starts')}
Expand Down
219 changes: 107 additions & 112 deletions packages/dev/src/CustomCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
QuickStartCatalogFilterSearchWrapper,
QuickStartCatalogFilterStatusWrapper,
QuickStartCatalogHeader,
QuickStartCatalogSection,
QuickStartCatalogToolbar,
QuickStartContext,
QuickStartContextValues,
Expand All @@ -23,6 +22,8 @@ import {
Divider,
Gallery,
GalleryItem,
PageSection,
Stack,
Text,
TextContent,
ToolbarContent,
Expand Down Expand Up @@ -84,63 +85,19 @@ export const CustomCatalog: React.FC = () => {

const [bookmarked, setBookmarked] = React.useState<string[]>([]);

const CatalogWithSections = React.useMemo(
() => (
<>
{bookmarked.length > 0 && (
<QuickStartCatalogSection>
<TextContent>
<Text component="h2">Bookmarked</Text>
<Text component="p" className="catalog-sub">
Bookmarked examples
</Text>
</TextContent>
<Gallery className="pfext-quick-start-catalog__gallery" hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => bookmarked.includes(quickStart.metadata.name))
.map((quickStart: QuickStart) => {
const {
metadata: { name: id },
} = quickStart;

return (
<GalleryItem key={id} className="pfext-quick-start-catalog__gallery-item">
<QuickStartTile
action={{
onClick: (e: React.SyntheticEvent) => {
e.preventDefault();
e.stopPropagation();
setBookmarked((prev) => {
if (prev.includes(id)) {
return prev.filter((bookmark) => bookmark !== id);
}

return [...prev, id];
});
},
icon: bookmarked.includes(id) ? BookmarkIcon : OutlinedBookmarkIcon,
'aria-label': 'bookmark',
}}
quickStart={quickStart}
isActive={id === activeQuickStartID}
status={getQuickStartStatus(allQuickStartStates, id)}
/>
</GalleryItem>
);
})}
</Gallery>
</QuickStartCatalogSection>
)}
<QuickStartCatalogSection>
const CatalogWithSections = (
<Stack hasGutter>
{bookmarked.length > 0 && (
<div>
<TextContent>
<Text component="h2">Instructional</Text>
<Text component="h2">Bookmarked</Text>
<Text component="p" className="catalog-sub">
Instructional examples
Bookmarked examples
</Text>
</TextContent>
<Gallery className="pfext-quick-start-catalog__gallery" hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => quickStart.metadata.instructional)
.filter((quickStart: QuickStart) => bookmarked.includes(quickStart.metadata.name))
.map((quickStart: QuickStart) => {
const {
metadata: { name: id },
Expand Down Expand Up @@ -172,55 +129,91 @@ export const CustomCatalog: React.FC = () => {
);
})}
</Gallery>
</QuickStartCatalogSection>
<QuickStartCatalogSection>
<TextContent>
<Text component="h2">Real-world examples</Text>
<Text component="p" className="catalog-sub">
Additional examples
</Text>
</TextContent>
<Gallery className="pfext-quick-start-catalog__gallery" hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => !quickStart.metadata.instructional)
.map((quickStart: QuickStart) => {
const {
metadata: { name: id },
} = quickStart;
</div>
)}
<div>
<TextContent>
<Text component="h2">Instructional</Text>
<Text component="p" className="catalog-sub">
Instructional examples
</Text>
</TextContent>
<Gallery hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => quickStart.metadata.instructional)
.map((quickStart: QuickStart, index: number) => {
const {
metadata: { name: id },
} = quickStart;

return (
<GalleryItem key={id} className="pfext-quick-start-catalog__gallery-item">
<QuickStartTile
action={{
onClick: (e: React.SyntheticEvent) => {
e.preventDefault();
e.stopPropagation();
setBookmarked((prev) => {
if (prev.includes(id)) {
return prev.filter((bookmark) => bookmark !== id);
}
return (
<QuickStartTile
key={index}
action={{
onClick: (e: React.SyntheticEvent) => {
e.preventDefault();
e.stopPropagation();
setBookmarked((prev) => {
if (prev.includes(id)) {
return prev.filter((bookmark) => bookmark !== id);
}

return [...prev, id];
});
},
icon: bookmarked.includes(id) ? BookmarkIcon : OutlinedBookmarkIcon,
'aria-label': 'bookmark',
}}
quickStart={quickStart}
isActive={id === activeQuickStartID}
status={getQuickStartStatus(allQuickStartStates, id)}
/>
</GalleryItem>
);
})}
</Gallery>
</QuickStartCatalogSection>
<QuickStartCatalogSection>
<Divider />
</QuickStartCatalogSection>
</>
),
[activeQuickStartID, allQuickStartStates, allQuickStarts, bookmarked],
return [...prev, id];
});
},
icon: bookmarked.includes(id) ? BookmarkIcon : OutlinedBookmarkIcon,
'aria-label': 'bookmark',
}}
quickStart={quickStart}
isActive={id === activeQuickStartID}
status={getQuickStartStatus(allQuickStartStates, id)}
/>
);
})}
</Gallery>
</div>
<div>
<TextContent>
<Text component="h2">Real-world examples</Text>
<Text component="p" className="catalog-sub">
Additional examples
</Text>
</TextContent>
<Gallery hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => !quickStart.metadata.instructional)
.map((quickStart: QuickStart, index: number) => {
const {
metadata: { name: id },
} = quickStart;

return (
<QuickStartTile
key={index}
action={{
onClick: (e: React.SyntheticEvent) => {
e.preventDefault();
e.stopPropagation();
setBookmarked((prev) => {
if (prev.includes(id)) {
return prev.filter((bookmark) => bookmark !== id);
}

return [...prev, id];
});
},
icon: bookmarked.includes(id) ? BookmarkIcon : OutlinedBookmarkIcon,
'aria-label': 'bookmark',
}}
quickStart={quickStart}
isActive={id === activeQuickStartID}
status={getQuickStartStatus(allQuickStartStates, id)}
/>
);
})}
</Gallery>
</div>
</Stack>
);

const clearFilters = React.useCallback(() => {
Expand All @@ -234,7 +227,7 @@ export const CustomCatalog: React.FC = () => {
);
}, [allQuickStarts, setFilter]);

const quickStartCatalog = React.useMemo(() => {
const quickStartCatalog = () => {
if (filteredQuickStarts.length === 0) {
return <QuickStartCatalogEmptyState clearFilters={clearFilters} />;
}
Expand All @@ -244,25 +237,27 @@ export const CustomCatalog: React.FC = () => {
}

return CatalogWithSections;
}, [CatalogWithSections, allQuickStarts.length, clearFilters, filteredQuickStarts]);
};

if (loading) {
return <LoadingBox />;
}

return (
<>
<QuickStartCatalogHeader title="Resources" />
<Divider component="div" />
<QuickStartCatalogToolbar>
<ToolbarContent>
<QuickStartCatalogFilterSearchWrapper onSearchInputChange={onSearchInputChange} />
<QuickStartCatalogFilterStatusWrapper onStatusChange={onStatusChange} />
<QuickStartCatalogFilterCountWrapper quickStartsCount={filteredQuickStarts.length} />
</ToolbarContent>
</QuickStartCatalogToolbar>
<Divider component="div" />
{quickStartCatalog}
<PageSection>
<QuickStartCatalogHeader title="Resources" />
<Divider component="div" />
<QuickStartCatalogToolbar>
<ToolbarContent>
<QuickStartCatalogFilterSearchWrapper onSearchInputChange={onSearchInputChange} />
<QuickStartCatalogFilterStatusWrapper onStatusChange={onStatusChange} />
<QuickStartCatalogFilterCountWrapper quickStartsCount={filteredQuickStarts.length} />
</ToolbarContent>
</QuickStartCatalogToolbar>
<Divider component="div" />
</PageSection>
<PageSection>{quickStartCatalog()}</PageSection>
</>
);
};
24 changes: 12 additions & 12 deletions packages/dev/src/FormInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export const FormInput = ({
inputValue: string;
setInputValue: any;
}) => (
<Form isWidthLimited>
<FormGroup label="Substitution for 'CENTRAL'" isRequired fieldId="central-name">
<TextInput
value={inputValue}
type="text"
id="central-name"
name="horizontal-form-name"
onChange={setInputValue}
/>
</FormGroup>
</Form>
);
<Form isWidthLimited>
<FormGroup label="Substitution for 'CENTRAL'" isRequired fieldId="central-name">
<TextInput
value={inputValue}
type="text"
id="central-name"
name="horizontal-form-name"
onChange={setInputValue}
/>
</FormGroup>
</Form>
);
2 changes: 1 addition & 1 deletion packages/dev/src/MockConsole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const FormGroupWithHelpTopicPopover: React.FC<FormGroupWithHelpTopicPopoverProps
isRequired
fieldId={topic.name}
key={topic.name}
>
>
<TextInput isRequired type="text" id={topic.name} />
</FormGroup>
);
Expand Down
Loading