Skip to content

Commit

Permalink
feat: Update expand filter button (#640)
Browse files Browse the repository at this point in the history
Update expand filter button to make it clear that there are more filters than the quick
  • Loading branch information
EdwardBrunton authored Sep 19, 2024
1 parent d80012c commit 9d53aa1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/filter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-filter",
"version": "4.0.3",
"version": "4.0.4",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down
29 changes: 21 additions & 8 deletions packages/filter/src/lib/components/quickFilter/QuickFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import { FilterQuickSearch } from '../filterQuickSearch/FilterQuickSearch';
import { FiltersAppliedInfo } from '../filtersAppliedInfo/FiltersAppliedInfo';
import { FilterGroup as IFilterGroup } from '../../types';
import { useFilterContext } from '../../context/filterContext';
import { StyledButton } from '../toggleHideFilterPopover/toggleHideFilterPopover.styles';
import { StyledButton, StyledButtonContent } from '../toggleHideFilterPopover/toggleHideFilterPopover.styles';
import { FilterClearIcon, FilterCollapseIcon, FilterExpandIcon } from '../../icons';
import { ToggleHideFilterPopover } from '../toggleHideFilterPopover/ToggleHideFilterPopover';
import { FilterView } from '../filterView/FilterView';
import { useFilterStyles } from '../../hooks/useFilterStyles';
import { FilterLoadingFallback } from '../Filter';
import { Button, Tooltip } from '@equinor/eds-core-react';

/**
* How to separate controller and visual logic in this component?
Expand Down Expand Up @@ -111,13 +112,25 @@ const QuickFilterReady = ({ groups }: QuickFilterReadyProps) => {
<FiltersAppliedInfo activeFilters={calculateHiddenFiltersApplied()} />
{isFilterExpanded && <ToggleHideFilterPopover allFilters={allFilterGroups} setFilterOrder={setFilterOrder} />}

<StyledButton onClick={() => clearActiveFilters()}>
<FilterClearIcon isDisabled={uncheckedValues.map((s) => s.values).flat().length === 0} />
</StyledButton>

<StyledButton onClick={toggleFilterIsExpanded}>
{isFilterExpanded ? <FilterCollapseIcon /> : <FilterExpandIcon />}
</StyledButton>
<Tooltip title="Clear all active filters">
<StyledButton onClick={() => clearActiveFilters()}>
<FilterClearIcon isDisabled={uncheckedValues.map((s) => s.values).flat().length === 0} />
</StyledButton>
</Tooltip>

<Tooltip title={isFilterExpanded ? 'Hide all filter options' : 'Show all filter options'}>
<Button variant="ghost" onClick={toggleFilterIsExpanded}>
{isFilterExpanded ? (
<StyledButtonContent>
<FilterCollapseIcon /> <div>Hide all</div>
</StyledButtonContent>
) : (
<StyledButtonContent>
<FilterExpandIcon /> <div>Show all</div>
</StyledButtonContent>
)}
</Button>
</Tooltip>
</StyledButtonWrapper>
</StyledCompactFilterWrapper>
{isFilterExpanded && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const StyledCompactFilterWrapper = styled.div<{ isExpanded: boolean }>`
height: 48px;
width: 100%;
background-color: ${tokens.colors.ui.background__light.hex};
padding: 0 6px;
box-sizing: border-box;
`;

export const StyledQuickFilterGroupsLayout = styled.div`
Expand All @@ -36,4 +38,5 @@ export const StyledButtonWrapper = styled.div`
align-items: center;
justify-content: flex-end;
background-color: ${tokens.colors.ui.background__light.hex};
gap: 10px;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ export const StyledButton = styled.button`
align-items: center;
text-align: center;
`;

export const StyledButtonContent = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
width: 80px;
white-space: nowrap;
`;
2 changes: 1 addition & 1 deletion packages/workspace-fusion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-fusion",
"version": "9.0.11",
"version": "9.0.12",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down

0 comments on commit 9d53aa1

Please sign in to comment.