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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.2.98",
3
+ "version": "0.2.100",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -77,7 +77,7 @@ export const Main: Story = {
77
77
  },
78
78
  ],
79
79
  outerLoading: false,
80
- siteId: undefined,
80
+ locationIds: undefined,
81
81
  },
82
82
  render: (args) => (
83
83
  <div style={{ background: 'white', padding: '30px', height: '100vh' }}>
@@ -36,7 +36,7 @@ export default function FilterBar({
36
36
  mode,
37
37
  tabs,
38
38
  outerLoading,
39
- siteId,
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
- siteId,
67
+ locationIds,
68
68
  })
69
69
 
70
70
  // Scroll in to view
@@ -12,7 +12,7 @@ export type FilterBarTypes = {
12
12
  mode?: string
13
13
  tabs?: Tab[]
14
14
  outerLoading?: boolean
15
- siteId?: string
15
+ locationIds?: string[]
16
16
  }
17
17
 
18
18
  export type AgeCategoryCount = {
@@ -15,7 +15,7 @@ type Props = {
15
15
  ageCategories?: AgeCategoryType[]
16
16
  onSubmit?: ((val: Filters) => void) | null
17
17
  tabs?: Tab[]
18
- siteId?: string
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
- siteId,
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 siteIdParam = siteId ? `siteId=${siteId}` : ''
121
- const querySearchParam = querySearchParams
122
- ? querySearchParams.toString()
123
- : ''
120
+ const params = new URLSearchParams(querySearchParams ?? undefined)
124
121
 
125
- const params = [siteIdParam, querySearchParam].filter(Boolean).join('&')
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 = params ? `${path}?${params}` : path
132
+ window.location.href = paramString ? `${path}?${paramString}` : path
130
133
  }
131
134
  }
132
135