willba-component-library 0.1.48 → 0.1.50

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.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -45,7 +45,7 @@ export const Primary: Story = {
45
45
  },
46
46
  render: (args) => (
47
47
  <div style={{ background: 'grey', padding: '30px', height: '100vh' }}>
48
- <FilterBar {...args} onSubmit={(val: Filters) => console.log(val)} />
48
+ <FilterBar {...args} onSubmit={(val: Filters) => null} />
49
49
  </div>
50
50
  ),
51
51
  }
@@ -24,7 +24,7 @@ export enum FilterSections {
24
24
  CATEGORIES = 'categories',
25
25
  }
26
26
 
27
- export type Filters = { [key: string]: string | number }
27
+ export type Filters = { [key: string]: string }
28
28
 
29
29
  export enum ViewApply {
30
30
  ROOMS = 'roomFilters',
@@ -92,7 +92,7 @@ export const useFilterBar = ({
92
92
  ? format(calendarRange.from, 'yyyy-MM-dd')
93
93
  : '',
94
94
  endDate: calendarRange?.to ? format(calendarRange.to, 'yyyy-MM-dd') : '',
95
- categories,
95
+ categories: categories.toString(),
96
96
  ageCategoryCounts: handleAgeCategoryRules({
97
97
  ageCategoryCounts,
98
98
  ageCategories,
@@ -121,15 +121,13 @@ export const useFilterBar = ({
121
121
 
122
122
  handleSelectedFilter(false)
123
123
 
124
- if (onSubmit) {
125
- const updatedParamsObject: { [key: string]: string | number } = {}
124
+ if (onSubmit && selectedPath === '/rooms') {
125
+ const updatedParamsObject: { [key: string]: string } = {}
126
126
 
127
127
  updatedParams.forEach((value, key) => {
128
- updatedParamsObject[key] = value
128
+ if (value) updatedParamsObject[key] = value
129
129
  })
130
130
 
131
- console.log('sdasdasdsad', updatedParamsObject)
132
-
133
131
  return onSubmit(updatedParamsObject)
134
132
  }
135
133
 
@@ -145,7 +143,7 @@ export const useFilterBar = ({
145
143
 
146
144
  handleSelectedFilter(false)
147
145
 
148
- return onSubmit
146
+ return onSubmit && selectedPath === '/rooms'
149
147
  ? onSubmit(newParams)
150
148
  : (window.location.href = `${redirectUrl}/${selectedPath}${
151
149
  querySearchParams ? `?${querySearchParams.toString()}` : ''