Skip to content

Commit

Permalink
fix: hide filter modal when in small screen [DHIS2-10439, DHIS2-10138] (
Browse files Browse the repository at this point in the history
#1545)

Add a div surrounding the popover content, in order to target it in css without having to use !important, and set display:none in small screen
  • Loading branch information
jenniferarnesen authored Feb 17, 2021
1 parent 1de7809 commit b81a1f4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
16 changes: 10 additions & 6 deletions src/components/ItemFilter/FilterSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ const FilterSelector = props => {
placement="bottom-start"
dataTest="dashboard-filter-popover"
>
<DimensionsPanel
style={{ width: '320px' }}
dimensions={props.dimensions}
onDimensionClick={selectDimension}
selectedIds={Object.keys(props.initiallySelectedItems)}
/>
<div className={classes.popover}>
<DimensionsPanel
style={{ width: '320px' }}
dimensions={props.dimensions}
onDimensionClick={selectDimension}
selectedIds={Object.keys(
props.initiallySelectedItems
)}
/>
</div>
</Popover>
)}
{!isEmpty(props.dimension) ? (
Expand Down
4 changes: 4 additions & 0 deletions src/components/ItemFilter/styles/FilterSelector.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
.buttonContainer {
display: none;
}

.popover {
display: none;
}
}
16 changes: 9 additions & 7 deletions src/components/ItemSelector/ItemSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ const ItemSelector = () => {
arrow={false}
maxWidth={700}
>
<FlyoutMenu
className={classes.menu}
dataTest="item-menu"
maxWidth="700px"
>
{getMenuGroups()}
</FlyoutMenu>
<div className={classes.popover}>
<FlyoutMenu
className={classes.menu}
dataTest="item-menu"
maxWidth="700px"
>
{getMenuGroups()}
</FlyoutMenu>
</div>
</Popover>
)}
</>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ItemSelector/styles/ItemSelector.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

@media only screen and (max-width: 480px) {
.menu {
display: none !important;
.popover {
display: none;
}
}

0 comments on commit b81a1f4

Please sign in to comment.