diff --git a/docs/componenten/README.mdx b/docs/componenten/README.mdx index 99af050e49..c07421a412 100644 --- a/docs/componenten/README.mdx +++ b/docs/componenten/README.mdx @@ -15,9 +15,10 @@ keywords: --- import { ComponentOverview } from "@site/src/components/ComponentOverview"; +import BrowserOnly from "@docusaurus/BrowserOnly"; # Componenten De componenten van NL Design System worden met een [estafette aanpak](/handboek/estafettemodel) gemaakt en kunnen dus verschillende statussen hebben. - +{() => } diff --git a/src/components/ComponentOverview.tsx b/src/components/ComponentOverview.tsx index cab36ab5ad..93b05bcc80 100644 --- a/src/components/ComponentOverview.tsx +++ b/src/components/ComponentOverview.tsx @@ -1,5 +1,4 @@ import type { PropSidebarItem, PropSidebarItemLink } from '@docusaurus/plugin-content-docs'; -import { useHistory } from '@docusaurus/router'; import { useCurrentSidebarCategory } from '@docusaurus/theme-common'; import { useDocById } from '@docusaurus/theme-common/internal'; import componentProgress from '@nl-design-system/component-progress/dist/index.json'; @@ -24,8 +23,7 @@ export const ComponentOverview = () => { }; const category = useCurrentSidebarCategory(); - const { location, push } = useHistory(); - + const { location } = window; const params = new URLSearchParams(location.search); const getComponent = (item: PropSidebarItemLink) => @@ -105,7 +103,13 @@ export const ComponentOverview = () => { params.append(SEARCH_PARAM, SEARCH_VALUES.ONLY_IMPLEMENTED); } - push({ ...location, search: params.toString() }); + if (params.size > 0) { + history.pushState({}, '', `?${params.toString()}`); + } else { + const url = new URL(window.location.href); + url.searchParams.delete('filter'); + history.pushState({}, '', url); + } }, [showTodo, showHelpWanted, showCommunity, showCandidate, showHallOfFame, showOnlyImplemented]); const todo = components.filter((c) => c.relayStep === 'UNKNOWN'); @@ -127,7 +131,7 @@ export const ComponentOverview = () => { { className: 'utrecht-accordion--nlds-subtle', headingLevel: 2, - expanded: false, + expanded: params.size > 0, // TODO: Make Pull Request for Utrecht Accordion to allow `ReactNode` // eslint-disable-next-line @typescript-eslint/no-explicit-any