@@ -2,7 +2,6 @@ import React from 'react';
22import { useIntl } from 'react-intl' ;
33import Button from '@hsl-fi/button' ;
44import PropTypes from 'prop-types' ;
5- import cx from 'classnames' ;
65import ValidityPeriodFilter from './ValidityPeriodFilter' ;
76import { useFilterContext } from './FiltersContext' ;
87import { useBreakpoint } from '../../../util/withBreakpoint' ;
@@ -28,10 +27,6 @@ const Filters = ({ onApplyClick = undefined, onResetClick = () => {} }) => {
2827 id : 'vehicleModes' ,
2928 Component : VehicleModesFilter ,
3029 } ,
31- {
32- id : 'separator-1' ,
33- Component : Separator ,
34- } ,
3530 {
3631 id : 'validityPeriod' ,
3732 Component : ValidityPeriodFilter ,
@@ -53,28 +48,23 @@ const Filters = ({ onApplyClick = undefined, onResetClick = () => {} }) => {
5348 }
5449 } ;
5550
56- return (
57- < form
58- className = { cx ( 'traffic-now__filters' , {
59- 'traffic-now__filters-mobile' : mobile ,
60- } ) }
61- >
62- { components . map ( ( { id, Component } ) => (
63- < Component key = { id } filterId = { id } />
64- ) ) }
51+ const buttons = (
52+ < >
6553 { onApplyClick && (
6654 < Button
6755 type = "button"
6856 size = "medium"
6957 fullWidth
7058 variant = "blue"
71- value = { intl . formatMessage ( { id : 'traffic-now_filters_view-results' } ) }
59+ value = { intl . formatMessage ( {
60+ id : 'traffic-now_filters_view-results' ,
61+ } ) }
7262 onClick = { onApplyClick }
7363 />
7464 ) }
7565 < Button
7666 type = "button"
77- size = { mobile ? ' medium' : 'small' }
67+ size = " medium"
7868 disabled = {
7969 JSON . stringify ( selectedFilters ) === JSON . stringify ( DEFAULT_FILTERS )
8070 }
@@ -83,6 +73,24 @@ const Filters = ({ onApplyClick = undefined, onResetClick = () => {} }) => {
8373 value = { intl . formatMessage ( { id : 'clear-button-label' } ) }
8474 onClick = { handleResetClick }
8575 />
76+ </ >
77+ ) ;
78+
79+ return mobile ? (
80+ < div >
81+ < form className = "traffic-now__filters traffic-now__filters-mobile" >
82+ { components . map ( ( { id, Component } ) => (
83+ < Component key = { id } filterId = { id } />
84+ ) ) }
85+ </ form >
86+ < div className = "traffic-now__filters-form-buttons" > { buttons } </ div >
87+ </ div >
88+ ) : (
89+ < form className = "traffic-now__filters" >
90+ { components . map ( ( { id, Component } ) => (
91+ < Component key = { id } filterId = { id } />
92+ ) ) }
93+ { buttons }
8694 </ form >
8795 ) ;
8896} ;
0 commit comments