Skip to content

Commit

Permalink
Set Dataset subfilter expanded by default and reduce margins (#788)
Browse files Browse the repository at this point in the history
* Filter fixes

* Using isMobile config for button content check
  • Loading branch information
DavidQuartz authored Feb 3, 2022
1 parent 8c70160 commit 54b2b59
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function FilterItems({
const active = customFilters.find(value => value === item.id);
return (
<Checkbox
className="gn-sub-filter-items"
type="checkbox"
checked={!!active}
value={item.id}
Expand Down Expand Up @@ -137,7 +138,7 @@ function FilterItems({
});
}}>
<Message msgId={field.labelId}/>
{!!active && filterChild()}
{filterChild()}
</Checkbox>
</FormGroup>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Dropdown from '@js/components/Dropdown';
import Button from '@js/components/Button';
import Badge from '@js/components/Badge';
import Message from '@mapstore/framework/components/I18N/Message';
import { getConfigProp } from '@mapstore/framework/utils/ConfigUtils';
import FaIcon from '@js/components/FaIcon';
import useLocalStorage from '@js/hooks/useLocalStorage';
import Menu from '@js/components/Menu';
Expand All @@ -31,11 +32,13 @@ const FiltersMenu = forwardRef(({
loading
}, ref) => {

const { isMobile } = getConfigProp('geoNodeSettings');
const selectedSort = orderOptions.find(({ value }) => order === value);
const [cardLayoutStyle, setCardLayoutStyle] = useLocalStorage('layoutCardsStyle', 'grid');
function handleToggleCardLayoutStyle() {
setCardLayoutStyle(cardLayoutStyle === 'grid' ? 'list' : 'grid');
}

return (
<div
className="gn-filters-menu gn-menu gn-default"
Expand All @@ -50,7 +53,7 @@ const FiltersMenu = forwardRef(({
size="sm"
onClick={onClick}
>
<FaIcon name="filter" />
{isMobile ? <FaIcon name="filter" /> : 'Filter'}
</Button>
{' '}
<Badge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,14 @@
}
}
}

.gn-sub-filter-items.checkbox {

&:first-of-type {
margin-top: 5px;
}

&:last-child {
margin-bottom: 0;
}
}

0 comments on commit 54b2b59

Please sign in to comment.