Skip to content

Commit

Permalink
spaghetti
Browse files Browse the repository at this point in the history
  • Loading branch information
charmingduchess committed Nov 28, 2023
1 parent 5bde4f2 commit 5b29fb0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
26 changes: 19 additions & 7 deletions src/components/ItemFilters/FiltersContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ interface ItemFilterContainerProps {

const ItemFilterContainer = ({ itemAggs }: ItemFilterContainerProps) => {
const router = useRouter()
const { isLargerThanMedium } = useNYPLBreakpoints()
const filterGroupClassName = isLargerThanMedium
const { isLargerThanLarge, isLargerThanMedium } = useNYPLBreakpoints()
const filterGroupClassName = isLargerThanLarge
? styles.filterGroup
: styles.filterGroupMobile

console.log(filterGroupClassName)
const filterData = useRef(
itemAggs.map((agg: ItemAggregation) => {
if (agg.field === "location") return new LocationFilterData(agg)
Expand Down Expand Up @@ -79,13 +79,25 @@ const ItemFilterContainer = ({ itemAggs }: ItemFilterContainerProps) => {

return (
<>
<Box className={styles.filtersContainer} sx={{ display: "flex" }}>
<Box
className={styles.filtersContainer}
sx={{
display: "flex",
flexDirection: isLargerThanMedium ? "row" : "column",
}}
>
<Card className={filterGroupClassName} ref={ref}>
<CardHeading level="h3" size="body2">
Filter by
</CardHeading>
<CardContent>
<SimpleGrid gap="nypl-s">
<Box
sx={{
display: "flex",
flexDirection: isLargerThanLarge ? "row" : "column",
}}
gap="nypl-s"
>
{filterData.map((field: ItemFilterData) => (
<ItemFilter
isOpen={whichFilterIsOpen === field.field}
Expand All @@ -96,7 +108,7 @@ const ItemFilterContainer = ({ itemAggs }: ItemFilterContainerProps) => {
submitFilters={submitFilters}
/>
))}
</SimpleGrid>
</Box>
</CardContent>
</Card>
<Card className={filterGroupClassName}>
Expand All @@ -113,7 +125,7 @@ const ItemFilterContainer = ({ itemAggs }: ItemFilterContainerProps) => {
id="year-filter"
labelText="Apply"
textInputProps={{
defaultValue: "Horizon",
defaultValue: "YYYY",
isClearable: true,
labelText: "Item Search",
name: "textInputName",
Expand Down
6 changes: 2 additions & 4 deletions styles/components/ItemFilters.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

// The gray box that holds the filter groups
.filtersContainer {
display: flex;
flex-wrap: wrap;
background-color: var(--nypl-colors-ui-gray-x-light-cool);
padding: 16px;
min-height: 128px;
Expand All @@ -15,11 +13,11 @@
// there are the aggregation filters and the search by year filter
.filterGroupMobile {
flex-grow: 1;
& .itemFilterOptionsContainer {
.itemFilterOptionsContainer {
position: relative;
width: inherit;
}
& .itemFilter {
.itemFilter {
margin-right: 0px;
}
}
Expand Down

0 comments on commit 5b29fb0

Please sign in to comment.