Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed[Filter]: Made Filter Buttons Sticky for Enhanced Usability #2419

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/App/SideBar/FilterSearch/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ describe('FilterSearch Component', () => {
expect(type1Pill).toHaveStyle(`color: ${colors.black}`)
})

it('should apply filters when "Show Results" is clicked', async () => {
it('should apply filters when "Apply" is clicked', async () => {
renderComponent()

const type1Pill = screen.getByText('Type1')

fireEvent.click(type1Pill)

const showResultsButton = screen.getByText('Show Results')
const showResultsButton = screen.getByText('Apply')

fireEvent.click(showResultsButton)

Expand Down
21 changes: 14 additions & 7 deletions src/components/App/SideBar/FilterSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export const FilterSearch = ({ anchorEl, setAnchorEl, onClose }: Props) => {
<Hops hops={hops} setHops={setHops} />
<LineBar />
<MaxResults maxResults={maxResults} setMaxResults={setMaxResults} />
<LineBar />
<PopoverFooter>
<LineBar />
<ButtonsWrapper>
<ClearButton
color="secondary"
Expand All @@ -130,7 +130,7 @@ export const FilterSearch = ({ anchorEl, setAnchorEl, onClose }: Props) => {
Clear
</ClearButton>
<ShowResultButton color="secondary" onClick={handleFiltersApply} size="large" variant="contained">
Show Results
Apply
</ShowResultButton>
</ButtonsWrapper>
</PopoverFooter>
Expand All @@ -142,34 +142,41 @@ const SearchFilterPopover = styled(Popper)`
&&.MuiPopper-root {
background: ${colors.BG2};
padding: 16px;
min-width: 360px;
max-height: calc(100% - 20%);
color: ${colors.white};
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.2);
border-radius: 9px;
max-width: 361px;
overflow-x: hidden;
padding-bottom: 0 !important;
overflow-y: auto;
border: 1px solid ${colors.black};
z-index: 100;
position: relative;
&::-webkit-scrollbar {
width: 3px;
height: auto;
}

&::-webkit-scrollbar-track {
background: ${colors.BG2};
border-radius: 9px;
margin: 5px;
margin-top: 5px;
margin-bottom: 68px;
overflow-y: hidden;
}
}
`

const PopoverFooter = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 8px;
padding: 0px 8px 8px 8px;
position: sticky;
bottom: 0;
background: ${colors.BG2};
width: calc(100% + 32px);
margin: -16px;
`

const LineBar = styled.div`
Expand Down Expand Up @@ -265,7 +272,7 @@ export const SourceNodesStepWrapper = styled.div`

export const ButtonsWrapper = styled(Flex)`
flex-direction: row;
margin: 0 0 6px 8px;
margin: 0 0 6px 3px;
`

export const PopoverBody = styled.div`
Expand Down
Loading