willba-component-library 0.1.50 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +2 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +2 -2
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +4 -1
- package/src/components/FilterBar/FilterBar.tsx +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +3 -4
package/package.json
CHANGED
|
@@ -45,7 +45,10 @@ export const Primary: Story = {
|
|
|
45
45
|
},
|
|
46
46
|
render: (args) => (
|
|
47
47
|
<div style={{ background: 'grey', padding: '30px', height: '100vh' }}>
|
|
48
|
-
<FilterBar
|
|
48
|
+
<FilterBar
|
|
49
|
+
{...args}
|
|
50
|
+
onSubmit={false ? null : (val: Filters) => console.log(val)}
|
|
51
|
+
/>
|
|
49
52
|
</div>
|
|
50
53
|
),
|
|
51
54
|
}
|
|
@@ -8,7 +8,7 @@ type Props = {
|
|
|
8
8
|
redirectUrl?: string
|
|
9
9
|
currentViewApply?: string
|
|
10
10
|
ageCategories?: AgeCategoryType[]
|
|
11
|
-
onSubmit?: (val: Filters) => void
|
|
11
|
+
onSubmit?: ((val: Filters) => void) | null
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const useFilterBar = ({
|
|
@@ -121,7 +121,7 @@ export const useFilterBar = ({
|
|
|
121
121
|
|
|
122
122
|
handleSelectedFilter(false)
|
|
123
123
|
|
|
124
|
-
if (onSubmit
|
|
124
|
+
if (onSubmit) {
|
|
125
125
|
const updatedParamsObject: { [key: string]: string } = {}
|
|
126
126
|
|
|
127
127
|
updatedParams.forEach((value, key) => {
|
|
@@ -142,8 +142,7 @@ export const useFilterBar = ({
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
handleSelectedFilter(false)
|
|
145
|
-
|
|
146
|
-
return onSubmit && selectedPath === '/rooms'
|
|
145
|
+
return onSubmit
|
|
147
146
|
? onSubmit(newParams)
|
|
148
147
|
: (window.location.href = `${redirectUrl}/${selectedPath}${
|
|
149
148
|
querySearchParams ? `?${querySearchParams.toString()}` : ''
|