diff --git a/src/common/components/Table.module.scss b/src/common/components/Table.module.scss index bcb9ee14..774c7a39 100644 --- a/src/common/components/Table.module.scss +++ b/src/common/components/Table.module.scss @@ -34,21 +34,26 @@ $header-height: 2em; } .pagination { - align-items: stretch; - display: flex; - flex-flow: row nowrap; - gap: 0.333em; - justify-content: flex-start; - max-width: 20em; + display: block; + text-align: right; * { - flex: 1 1 2.25em; - min-width: fit-content; + display: inline-block; + margin-left: 0.5rem; + } + + *:first-child { + margin-left: 0; + } + + [disabled] { + color: #000; } - *:first-child, - *:last-child { - flex: 0 1 2.25em; + .selected { + background-color: use-color("mid-green-light"); + color: #000; + opacity: 1; } } diff --git a/src/common/components/Table.tsx b/src/common/components/Table.tsx index 69d42f87..d514e5e3 100644 --- a/src/common/components/Table.tsx +++ b/src/common/components/Table.tsx @@ -165,7 +165,7 @@ export const Pagination = ({ if (buttons[0] !== start) { buttons[0] = start; buttons[1] = ( - ); @@ -173,7 +173,7 @@ export const Pagination = ({ buttons.unshift( - + {showSearch && ( + + )} + {showMatchButton && ( + + )} -
- +
+
)} @@ -231,12 +226,11 @@ export const CollectionDetail = () => { open={filterPanelOpen ?? false} onClose={() => { if (collection?.id) { - dispatch(setFilterPanelOpen(filterPanelOpen)); + dispatch(setFilterPanelOpen(false)); } }} />
- {showOverview ? ( { modal={modal} /> ) : currDataProduct ? ( - + <> + {showFilterButton && ( + + +
+ {filterEntries ? filterEntries.length : '0'} active{' '} + {filterEntries && filterEntries.length !== 1 + ? 'filters' + : 'filter'} + {filterEntries && filterEntries.length > 0 ? ':' : ''} +
+ +
+ )} + + ) : ( <> )} @@ -303,9 +323,13 @@ const useFilterEntries = (collectionId: string) => { ); // Use same filter order if ignoring categories for consistency + // Only include filters who have a non-undefined value const filterEntries = categorizedFilters.reduce<[string, FilterState][]>( (filterEntires, category) => { - filterEntires.push(...category.filters); + const activeFilters = category.filters.filter( + (f) => f[1].value !== undefined + ); + filterEntires.push(...activeFilters); return filterEntires; }, [] @@ -334,13 +358,7 @@ const FilterChips = ({ collectionId }: { collectionId: string }) => { useFilterEntries(collectionId); if (filterEntries.length === 0) return <>; return ( - + {filterEntries.map(([column, filter]) => { return ( { - const expanded: { [key: string]: boolean } = {}; - categorizedFilters.forEach((category) => { - expanded[category.category] = false; - }); - return expanded; - }); + const [expandedCategory, setExpandedCategory] = useState(''); /** * Only allow one category to be expanded at a time. */ const handleExpand = (expanded: boolean, category: string) => { - const newValue = { ...expandedByCategory }; - Object.keys(expandedByCategory).forEach((c) => { - if (expanded && c === category) { - newValue[c] = true; - } else { - newValue[c] = false; - } - }); - setExpandedByCategory(newValue); + setExpandedCategory(expanded ? category : ''); }; if (open) { @@ -430,7 +434,7 @@ const FilterMenu = ({ key={`${category.category}-${context}`} className={styles['filter-category']} elevation={0} - expanded={expandedByCategory[category.category]} + expanded={category.category === expandedCategory} onChange={(e, expanded) => handleExpand(expanded, category.category) } diff --git a/src/features/collections/CollectionOverview.tsx b/src/features/collections/CollectionOverview.tsx index a90ea7b0..9a61d986 100644 --- a/src/features/collections/CollectionOverview.tsx +++ b/src/features/collections/CollectionOverview.tsx @@ -82,6 +82,15 @@ export const CollectionOverview: FC<{ sx={{ paddingBottom: 0 }} /> + + Collection Name + +
{collection.name}
+

{ )}
- +