willba-component-library 0.1.29 → 0.1.31
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/index.esm.js +6 -4
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +6 -4
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +1 -0
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +5 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +2 -7
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
|
|
3
3
|
import { GuestsCountPropsType } from '../../../FilterBarTypes'
|
|
4
4
|
|
|
@@ -12,6 +12,10 @@ export default function GuestCount({
|
|
|
12
12
|
count,
|
|
13
13
|
minVal,
|
|
14
14
|
}: GuestsCountPropsType) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (minVal) updateGuestsCount(`guests-${id}`, minVal)
|
|
17
|
+
}, [])
|
|
18
|
+
|
|
15
19
|
const handleDecrement = () => {
|
|
16
20
|
if (count > minVal) {
|
|
17
21
|
updateGuestsCount(`guests-${id}`, count - 1)
|
|
@@ -119,15 +119,11 @@ export default function useFilterBar({
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
console.log(currentSearchParams.toString(), updatedParams.toString())
|
|
123
|
-
|
|
124
|
-
// Get the current URL without the query string
|
|
125
122
|
const baseUrl = window.location.origin + window.location.pathname
|
|
126
123
|
|
|
127
|
-
// Construct the updated URL with the modified query parameters
|
|
128
124
|
const updatedUrl = `${baseUrl}?${updatedParams.toString()}`
|
|
129
125
|
|
|
130
|
-
|
|
126
|
+
handleSelectedFilter(false)
|
|
131
127
|
return (window.location.href = updatedUrl)
|
|
132
128
|
} else {
|
|
133
129
|
const querySearchParams = new URLSearchParams()
|
|
@@ -138,12 +134,11 @@ export default function useFilterBar({
|
|
|
138
134
|
}
|
|
139
135
|
}
|
|
140
136
|
|
|
137
|
+
handleSelectedFilter(false)
|
|
141
138
|
return (window.location.href = `${redirectUrl}/${selectedPath}${
|
|
142
139
|
querySearchParams ? `?${querySearchParams.toString()}` : ''
|
|
143
140
|
}`)
|
|
144
141
|
}
|
|
145
|
-
|
|
146
|
-
handleSelectedFilter(false)
|
|
147
142
|
}
|
|
148
143
|
|
|
149
144
|
const handleResetFilters = () => {
|