willba-component-library 0.2.98 → 0.2.100
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/FilterBarTypes.d.ts +1 -1
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.esm.js +11 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +11 -9
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +11 -9
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -1
- package/src/components/FilterBar/FilterBar.tsx +2 -2
- package/src/components/FilterBar/FilterBarTypes.ts +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +11 -8
- package/src/components/FilterCalendar/FilterCalendar.stories.tsx +275 -275
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@ export default function FilterBar({
|
|
|
36
36
|
mode,
|
|
37
37
|
tabs,
|
|
38
38
|
outerLoading,
|
|
39
|
-
|
|
39
|
+
locationIds,
|
|
40
40
|
}: FilterBarTypes) {
|
|
41
41
|
const themePalette = useTheme({ palette })
|
|
42
42
|
|
|
@@ -64,7 +64,7 @@ export default function FilterBar({
|
|
|
64
64
|
ageCategories,
|
|
65
65
|
onSubmit,
|
|
66
66
|
tabs,
|
|
67
|
-
|
|
67
|
+
locationIds,
|
|
68
68
|
})
|
|
69
69
|
|
|
70
70
|
// Scroll in to view
|
|
@@ -15,7 +15,7 @@ type Props = {
|
|
|
15
15
|
ageCategories?: AgeCategoryType[]
|
|
16
16
|
onSubmit?: ((val: Filters) => void) | null
|
|
17
17
|
tabs?: Tab[]
|
|
18
|
-
|
|
18
|
+
locationIds?: string[]
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const useFilterBar = ({
|
|
@@ -23,7 +23,7 @@ export const useFilterBar = ({
|
|
|
23
23
|
ageCategories,
|
|
24
24
|
onSubmit,
|
|
25
25
|
tabs,
|
|
26
|
-
|
|
26
|
+
locationIds,
|
|
27
27
|
}: Props) => {
|
|
28
28
|
const [selectedPath, setSelectedPath] = useState<string>(Pages.EVENTS)
|
|
29
29
|
const [selectedFilter, setSelectedFilter] = useState<string | boolean>(false)
|
|
@@ -117,16 +117,19 @@ export const useFilterBar = ({
|
|
|
117
117
|
if (onSubmit && window.location.href.includes(selectedPath)) {
|
|
118
118
|
onSubmit(newParams)
|
|
119
119
|
} else {
|
|
120
|
-
const
|
|
121
|
-
const querySearchParam = querySearchParams
|
|
122
|
-
? querySearchParams.toString()
|
|
123
|
-
: ''
|
|
120
|
+
const params = new URLSearchParams(querySearchParams ?? undefined)
|
|
124
121
|
|
|
125
|
-
|
|
122
|
+
if (locationIds) {
|
|
123
|
+
locationIds.forEach((id) => {
|
|
124
|
+
params.append('locationId', id)
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const paramString = params.toString()
|
|
126
129
|
const path = `${redirectUrl}${selectedPath}`
|
|
127
130
|
|
|
128
131
|
setInnerLoading(true)
|
|
129
|
-
window.location.href =
|
|
132
|
+
window.location.href = paramString ? `${path}?${paramString}` : path
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
|