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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -76,6 +76,7 @@ export default function FilterBar({
76
76
  setIsMobile(false)
77
77
  return
78
78
  }
79
+
79
80
  if (targetFilterBarRef.current && selectedFilter) {
80
81
  window.scrollTo({
81
82
  behavior: 'smooth',
@@ -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
- // Replace the current URL with the updated URL in the browser's history
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 = () => {