willba-component-library 0.1.23 → 0.1.25

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.25",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -111,13 +111,18 @@ export default function FilterBar({
111
111
  style={fontWeightBold(selectedFilter === 1)}
112
112
  />
113
113
 
114
- <Divider />
115
- <SelectButton
116
- label={'Who'}
117
- description={'Add Guests'}
118
- onClick={() => handleSelectedFilter(2)}
119
- style={fontWeightBold(selectedFilter === 2)}
120
- />
114
+ {selectedPath === '/rooms' && (
115
+ <>
116
+ <Divider />
117
+
118
+ <SelectButton
119
+ label={'Who'}
120
+ description={'Add Guests'}
121
+ onClick={() => handleSelectedFilter(2)}
122
+ style={fontWeightBold(selectedFilter === 2)}
123
+ />
124
+ </>
125
+ )}
121
126
 
122
127
  <SubmitButton onClick={handleSubmit} />
123
128
  </div>
@@ -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