willba-component-library 0.2.47 → 0.2.49
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/lib/components/FilterBar/hooks/useFilterBar.d.ts +3 -1
- package/lib/index.esm.js +9 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +9 -5
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +9 -5
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +3 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +5 -0
package/package.json
CHANGED
|
@@ -50,6 +50,7 @@ export default function FilterBar({
|
|
|
50
50
|
categories,
|
|
51
51
|
calendarRange,
|
|
52
52
|
selectedPath,
|
|
53
|
+
loading,
|
|
53
54
|
setCalendarRange,
|
|
54
55
|
setCategories,
|
|
55
56
|
handleSelectedFilter,
|
|
@@ -62,6 +63,7 @@ export default function FilterBar({
|
|
|
62
63
|
ageCategories,
|
|
63
64
|
onSubmit,
|
|
64
65
|
tabs,
|
|
66
|
+
isLoading,
|
|
65
67
|
})
|
|
66
68
|
|
|
67
69
|
// Scroll in to view
|
|
@@ -144,7 +146,7 @@ export default function FilterBar({
|
|
|
144
146
|
onClick={handleSubmit}
|
|
145
147
|
startIcon={<FaSearch />}
|
|
146
148
|
label={t('common:search')}
|
|
147
|
-
isLoading={
|
|
149
|
+
isLoading={loading}
|
|
148
150
|
/>
|
|
149
151
|
</div>
|
|
150
152
|
|
|
@@ -15,6 +15,7 @@ type Props = {
|
|
|
15
15
|
ageCategories?: AgeCategoryType[]
|
|
16
16
|
onSubmit?: ((val: Filters) => void) | null
|
|
17
17
|
tabs?: Tab[]
|
|
18
|
+
isLoading?: boolean
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const useFilterBar = ({
|
|
@@ -22,10 +23,12 @@ export const useFilterBar = ({
|
|
|
22
23
|
ageCategories,
|
|
23
24
|
onSubmit,
|
|
24
25
|
tabs,
|
|
26
|
+
isLoading,
|
|
25
27
|
}: Props) => {
|
|
26
28
|
const [selectedPath, setSelectedPath] = useState<string>(Pages.EVENTS)
|
|
27
29
|
const [selectedFilter, setSelectedFilter] = useState<string | boolean>(false)
|
|
28
30
|
const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
|
|
31
|
+
const [loading, setLoading] = useState<boolean>(isLoading || false)
|
|
29
32
|
|
|
30
33
|
const [categories, setCategories] = useState<number>(0)
|
|
31
34
|
const [ageCategoryCounts, setAgeCategoryCounts] = useState<AgeCategoryCount>(
|
|
@@ -122,6 +125,7 @@ export const useFilterBar = ({
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
handleSelectedFilter(false)
|
|
128
|
+
setLoading(true)
|
|
125
129
|
|
|
126
130
|
return onSubmit && selectedPath === Pages.ROOMS
|
|
127
131
|
? onSubmit(newParams)
|
|
@@ -141,6 +145,7 @@ export const useFilterBar = ({
|
|
|
141
145
|
categories,
|
|
142
146
|
calendarRange,
|
|
143
147
|
selectedPath,
|
|
148
|
+
loading,
|
|
144
149
|
setCalendarRange,
|
|
145
150
|
setSelectedFilter,
|
|
146
151
|
setAgeCategoryCounts,
|