diff --git a/components/productArea/sidebar.tsx b/components/productArea/sidebar.tsx index fc3cfd92..3376f830 100644 --- a/components/productArea/sidebar.tsx +++ b/components/productArea/sidebar.tsx @@ -1,120 +1,132 @@ -import { Data } from '@navikt/ds-icons' -import { Select } from '@navikt/ds-react' -import { useRouter } from 'next/router' +import {Data} from '@navikt/ds-icons' +import {SidebarLeftIcon} from '@navikt/aksel-icons' +import {Select} from '@navikt/ds-react' import * as React from 'react' -import { PAItems } from '../../pages/productArea/[id]' +import {useState} from 'react' +import {PAItems} from '../../pages/productArea/[id]' import DataproductLogo from '../lib/icons/dataproductLogo' interface ProductAreaSidebarProps { - productAreaItems: PAItems - setCurrentItem: (newCurrent: number) => void - currentItem: number - productAreas: any - selectProductArea: (productAreaId: string) => void + productAreaItems: PAItems + setCurrentItem: (newCurrent: number) => void + currentItem: number + productAreas: any + selectProductArea: (productAreaId: string) => void } const ProductAreaSidebar = ({ - productAreaItems, - setCurrentItem, - currentItem, - productAreas, - selectProductArea, -}: ProductAreaSidebarProps) => { - const relevantProductAreas = productAreas - .filter( - (it: any) => - it.dataproductsNumber || - it.storiesNumber || - it.insightProductsNumber - ).sort((l: any, r: any) => (l.name < r.name ? -1 : 1)) - return ( -
- -
- {productAreaItems.map((d: any, idx: number) => - d.stories.length + d.dataproducts.length + d.insightProducts.length ? ( -
- setCurrentItem(idx)} - > - {d.name} - -
+ productAreaItems, + setCurrentItem, + currentItem, + productAreas, + selectProductArea, + }: ProductAreaSidebarProps) => { + const relevantProductAreas = productAreas + .filter( + (it: any) => + it.dataproductsNumber || + it.storiesNumber || + it.insightProductsNumber + ).sort((l: any, r: any) => (l.name < r.name ? -1 : 1)) + + const [collapsed, setCollapsed] = useState(false) + return ( +
+ {/*
*/} + + {collapsed ? null : ( +
+ +
+ {productAreaItems.map((d: any, idx: number) => + d.stories.length + d.dataproducts.length + d.insightProducts.length ? ( +
+ setCurrentItem(idx)} + > + {d.name} + +
{' '} - {d.stories.length} + {d.stories.length} - +
- -
{' '} - {d.dataproducts.length} + +
+ {' '} + {d.dataproducts.length} - +
- -
{' '} - {d.insightProducts.length} + +
+ {' '} + {d.insightProducts.length} -
-
- ) : ( -
-

{d.name}

-
+
+
+ ) : ( +
+

{d.name}

+
{' '} - {d.stories.length} + {d.stories.length} - +
- -
{' '} - {d.dataproducts.length} + +
+ {' '} + {d.dataproducts.length} -
-
- ) - )} -
-
- ) +
+
+ ) + )} +
+ + )} + ) } - export default ProductAreaSidebar