willba-component-library 0.1.23 → 0.1.24

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.23",
3
+ "version": "0.1.24",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -11,14 +11,14 @@ export interface AgeCategoryType {
11
11
 
12
12
  export interface GuestsPropsType {
13
13
  ageCategories: AgeCategoryType[]
14
- updateGuestsCount: (arg1: number, arg2: number) => void
14
+ updateGuestsCount: (arg1: string, arg2: number) => void
15
15
  ageCategoryCounts: AgeCategoryCount | {}
16
16
  }
17
17
 
18
18
  export interface GuestsCountPropsType {
19
19
  label: string
20
20
  id: number
21
- updateGuestsCount: (arg1: number, arg2: number) => void
21
+ updateGuestsCount: (arg1: string, arg2: number) => void
22
22
  count: number
23
23
  minVal: number
24
24
  sortOrder: number
@@ -14,12 +14,12 @@ export default function GuestCount({
14
14
  }: GuestsCountPropsType) {
15
15
  const handleDecrement = () => {
16
16
  if (count > minVal) {
17
- updateGuestsCount(id, count - 1)
17
+ updateGuestsCount(`guests-${id}`, count - 1)
18
18
  }
19
19
  }
20
20
 
21
21
  const handleIncrement = () => {
22
- updateGuestsCount(id, count + 1)
22
+ updateGuestsCount(`guests-${id}`, count + 1)
23
23
  }
24
24
 
25
25
  return (
@@ -24,8 +24,9 @@ export default function Guests({
24
24
  sortOrder={category.sortOrder}
25
25
  updateGuestsCount={updateGuestsCount}
26
26
  count={
27
- (ageCategoryCounts as AgeCategoryCount)[category.id] ||
28
- category.minVal
27
+ (ageCategoryCounts as AgeCategoryCount)[
28
+ `guests-${category.id}`
29
+ ] || category.minVal
29
30
  }
30
31
  />
31
32
  ))}
@@ -19,10 +19,11 @@ export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
19
19
  {}
20
20
  )
21
21
 
22
- const updateGuestsCount = (id: number, newCount: number) => {
22
+ const updateGuestsCount = (id: string, newCount: number) => {
23
+ console.log(ageCategoryCounts)
23
24
  setAgeCategoryCounts((prevCounts) => ({
24
25
  ...prevCounts,
25
- [`guests-${id}`]: newCount,
26
+ [id]: newCount,
26
27
  }))
27
28
  }
28
29