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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
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,10 @@ 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) => null} />
48
+ <FilterBar
49
+ {...args}
50
+ onSubmit={false ? null : (val: Filters) => console.log(val)}
51
+ />
49
52
  </div>
50
53
  ),
51
54
  }
@@ -37,7 +37,7 @@ export type FilterBarProps = {
37
37
  redirectUrl?: string
38
38
  palette?: Palette
39
39
  currentViewApply?: string
40
- onSubmit?: (val: Filters) => void
40
+ onSubmit?: ((val: Filters) => void) | null
41
41
  }
42
42
 
43
43
  export default function FilterBar({
@@ -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 && selectedPath === '/rooms') {
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()}` : ''