Skip to content

Commit

Permalink
status checkbox on init
Browse files Browse the repository at this point in the history
  • Loading branch information
jschuler committed Jun 21, 2021
1 parent 5173a52 commit 6e76e7f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"serve": "serve public"
},
"dependencies": {
"@patternfly/quickstarts": "1.0.0-rc.15",
"@patternfly/quickstarts": "1.0.0-rc.16",
"@patternfly/react-core": "^4.101.3",
"asciidoctor": "^2.2.1",
"react": "^16.14.0",
Expand Down
21 changes: 7 additions & 14 deletions packages/dev/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,11 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
console.log(allQuickStartStates);
}, [allQuickStartStates]);

const [
allQuickStartsLoaded,
setAllQuickStartsLoaded,
] = React.useState<boolean>(false);
const [allQuickStarts, setAllQuickStarts] = React.useState<QuickStart[]>([]);
React.useEffect(() => {
const load = async () => {
const masGuidesQuickstarts = await loadJSONQuickStarts("");
setAllQuickStarts(yamlQuickStarts.concat(masGuidesQuickstarts));
setAllQuickStartsLoaded(true);
};
load();
}, []);
Expand Down Expand Up @@ -131,15 +126,13 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {

return (
<React.Suspense fallback={<LoadingBox />}>
{allQuickStartsLoaded && (
<QuickStartContextProvider value={valuesForQuickstartContext}>
<QuickStartDrawer>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
{children}
</Page>
</QuickStartDrawer>
</QuickStartContextProvider>
)}
{allQuickStarts && allQuickStarts.length && <QuickStartContextProvider value={valuesForQuickstartContext}>
<QuickStartDrawer>
<Page header={AppHeader} sidebar={AppSidebar} isManagedSidebar>
{children}
</Page>
</QuickStartDrawer>
</QuickStartContextProvider>}
</React.Suspense>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@patternfly/quickstarts",
"version": "1.0.0-rc.15",
"version": "1.0.0-rc.16",
"description": "PatternFly quick starts",
"files": [
"dist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ export const QuickStartCatalogFilterStatusWrapper: React.FC<QuickStartCatalogFil
);

const dropdownItems = Object.entries(filter.status.statusTypes).map(([key, val]) => (
<SelectOption key={key} data-key={key} value={val} />
<SelectOption key={key} data-key={key} value={key}>{val}</SelectOption>
));

return (
<QuickStartCatalogFilterSelect
isDropdownOpen={isDropdownOpen}
setIsDropdownOpen={setIsDropdownOpen}
onRowfilterSelect={onRowfilterSelect}
selectedFilters={filter.status.selectedFilters}
selectedFilters={filter.status.statusFilters}
dropdownItems={dropdownItems}
/>
);
Expand Down
6 changes: 0 additions & 6 deletions packages/module/src/utils/quick-start-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export type QuickStartContextValues = {
status?: {
statusTypes?: any;
statusFilters?: any;
selectedFilters?: any;
}
}
setFilter?: any;
Expand Down Expand Up @@ -124,9 +123,6 @@ export const QuickStartContextProvider: React.FC<{
[QuickStartStatus.NOT_STARTED]: findResource('Not started ({{statusCount, number}})').replace('{{statusCount, number}}', quickStartStatusCount[QuickStartStatus.NOT_STARTED]),
});
const [statusFilters, setStatusFilters] = React.useState<string[]>(initialStatusFilters);
const [selectedFilters, setSelectedFilters] = React.useState<string[]>(
initialStatusFilters.map((filter) => statusTypes[filter]),
);

const [filterKeyword, setFilterKeyword] = React.useState(initialSearchQuery);

Expand All @@ -135,7 +131,6 @@ export const QuickStartContextProvider: React.FC<{
setFilterKeyword(value);
} else if (type === 'status') {
setStatusFilters(value);
setSelectedFilters(value.map((filterKey) => statusTypes[filterKey]));
}
};

Expand Down Expand Up @@ -362,7 +357,6 @@ export const QuickStartContextProvider: React.FC<{
status: {
statusTypes,
statusFilters,
selectedFilters,
}
},
setFilter,
Expand Down

0 comments on commit 6e76e7f

Please sign in to comment.