Skip to content

Commit 7dc2a82

Browse files
authored
Merge pull request #1206 from HeyZoos/staging
[1196] Filter reset button
2 parents 14bfa9b + 8f75e4c commit 7dc2a82

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/app/find-properties/[[...opa_id]]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ const MapPage = ({ params }: MapPageProps) => {
288288
</div>
289289
</div>
290290
) : currentView === 'filter' ? (
291-
<FilterView updateCurrentView={updateCurrentView} />
291+
<FilterView />
292292
) : (
293293
<PropertyDetailSection
294294
featuresInView={featuresInView}

src/components/FilterView.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
'use client';
22

33
import { FC } from 'react';
4-
import { PiX } from 'react-icons/pi';
54
import { ThemeButton } from './ThemeButton';
65
import { BarClickOptions } from '@/app/find-properties/[[...opa_id]]/page';
76
import { rcos, neighborhoods, zoning } from './Filters/filterOptions';
87
import FilterDescription from './Filters/FilterDescription';
98
import ButtonGroup from './Filters/ButtonGroup';
109
import MultiSelect from './Filters/MultiSelect';
1110
import Panels from './Filters/Panels';
11+
import { useFilter } from '@/context/FilterContext';
1212

13-
interface FilterViewProps {
14-
updateCurrentView: (view: BarClickOptions) => void;
15-
}
13+
const FilterView: FC = () => {
14+
const { dispatch } = useFilter();
15+
16+
const onResetButtonPressed = () => {
17+
dispatch({
18+
type: 'CLEAR_DIMENSIONS',
19+
property: 'reset',
20+
dimensions: [],
21+
});
22+
};
1623

17-
const FilterView: FC<FilterViewProps> = ({ updateCurrentView }) => {
1824
return (
1925
<div className="relative p-6">
2026
{/* Add ID to the close button */}
2127
<ThemeButton
2228
color="secondary"
2329
className="right-4 lg:right-[24px] absolute top-8 min-w-[3rem]"
24-
aria-label="Close filter panel"
25-
startContent={<PiX />}
30+
label={'Reset'}
31+
aria-label="Reset filters"
2632
id="close-filter-button" // Add an ID to this button
27-
onPress={() => {
28-
updateCurrentView('filter');
29-
}}
33+
onPress={onResetButtonPressed}
3034
/>
3135
<div className="pt-3 pb-6">
3236
<FilterDescription

0 commit comments

Comments
 (0)