Skip to content

Commit

Permalink
Adds a separate pane for the filter CTAs, adds an apply button on mob…
Browse files Browse the repository at this point in the history
…ile (#1144)
  • Loading branch information
jkachel authored Jun 25, 2024
1 parent 871c040 commit 525230b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,13 @@ const StyledDrawer = styled(Drawer)`
}
`

const MobileClearAllButton = styled(Button)`
background-color: white;
padding: 12px;
border-radius: 4px;
const MobileFacetSearchButtons = styled.div`
display: flex;
gap: 12px;
& > button {
flex: 1;
}
`

const MobileDrawerCloseButton = styled(Button)`
Expand Down Expand Up @@ -659,15 +662,6 @@ const SearchDisplay: React.FC<SearchDisplayProps> = ({
<div>
<Typography variant="subtitle3">Filter</Typography>
</div>
{hasFacets ? (
<MobileClearAllButton
variant="text"
size="small"
onClick={clearAllFacets}
>
Clear all
</MobileClearAllButton>
) : null}
</div>
<MobileDrawerCloseButton
size="large"
Expand All @@ -678,6 +672,24 @@ const SearchDisplay: React.FC<SearchDisplayProps> = ({
<RiCloseLine fontSize="inherit" />
</MobileDrawerCloseButton>
</MobileFacetsTitleContainer>
{hasFacets ? (
<MobileFacetSearchButtons>
<Button
variant="primary"
size="small"
onClick={toggleMobileDrawer(false)}
>
Apply Filters
</Button>
<Button
variant="noBorder"
size="small"
onClick={clearAllFacets}
>
Clear All
</Button>
</MobileFacetSearchButtons>
) : null}
{filterContents}
</StyledDrawer>
<MobileSortContainer>{sortDropdown}</MobileSortContainer>
Expand Down
15 changes: 14 additions & 1 deletion frontends/ol-components/src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ const meta: Meta<typeof Button> = {
component: Button,
argTypes: {
variant: {
options: ["primary", "secondary", "tertiary", "text"],
options: [
"primary",
"secondary",
"tertiary",
"text",
"inverted",
"text-secondary",
],
control: { type: "select" },
},
size: {
Expand Down Expand Up @@ -82,6 +89,12 @@ export const VariantStory: Story = {
<Button {...args} variant="text">
Text
</Button>
<Button {...args} variant="noBorder">
Text Secondary
</Button>
<Button {...args} variant="inverted">
Inverted
</Button>
</Stack>
),
}
Expand Down
19 changes: 18 additions & 1 deletion frontends/ol-components/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import tinycolor from "tinycolor2"
import { Link } from "react-router-dom"
import type { Theme } from "@mui/material/styles"

type ButtonVariant = "primary" | "secondary" | "tertiary" | "text" | "inverted"
type ButtonVariant =
| "primary"
| "secondary"
| "tertiary"
| "text"
| "noBorder"
| "inverted"
type ButtonSize = "small" | "medium" | "large"
type ButtonEdge = "circular" | "rounded" | "none"

Expand Down Expand Up @@ -133,6 +139,17 @@ const ButtonStyled = styled.button<ButtonStyleProps>((props) => {
color: colors.silverGray,
},
},
variant === "noBorder" && {
backgroundColor: colors.white,
color: colors.darkGray2,
border: "none",
":hover:not(:disabled)": {
backgroundColor: tinycolor(colors.darkGray1).setAlpha(0.06).toString(),
},
":disabled": {
color: colors.silverGray,
},
},
variant === "tertiary" && {
color: colors.darkGray2,
border: "none",
Expand Down

0 comments on commit 525230b

Please sign in to comment.