willba-component-library 0.0.81 → 0.0.83
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/components/close-button/CloseButton.d.ts +7 -0
- package/lib/components/FilterBar/hooks/useFilterBar.d.ts +1 -0
- package/lib/index.esm.js +63 -29
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +63 -29
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +63 -29
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +14 -3
- package/src/components/FilterBar/FilterBar.tsx +22 -2
- package/src/components/FilterBar/components/calendar/Calendar.css +1 -1
- package/src/components/FilterBar/components/close-button/CloseButton.css +25 -0
- package/src/components/FilterBar/components/close-button/CloseButton.tsx +16 -0
- package/src/components/FilterBar/components/divider/Divider.css +1 -1
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +1 -1
- package/src/components/FilterBar/components/guests/Guests.css +1 -1
- package/src/components/FilterBar/components/select-button/SelectButton.css +1 -1
- package/src/components/FilterBar/components/submit-button/SubmitButton.css +1 -1
- package/src/components/FilterBar/hooks/useFilterBar.tsx +7 -5
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.will-root {
|
|
2
2
|
z-index: 99999;
|
|
3
3
|
width: 100%;
|
|
4
|
-
max-height:
|
|
4
|
+
max-height: 100vh;
|
|
5
5
|
position: relative;
|
|
6
|
+
overflow-y: auto;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.will-filter-bar {
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
box-shadow: var(--will-box-shadow);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
@media (max-width:
|
|
40
|
+
@media (max-width: 960px) {
|
|
40
41
|
.will-filter-bar-header {
|
|
41
42
|
flex-direction: column;
|
|
42
43
|
padding: 20px;
|
|
@@ -58,11 +59,21 @@
|
|
|
58
59
|
box-shadow: var(--will-box-shadow);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
@media (max-width:
|
|
62
|
+
@media (max-width: 960px) {
|
|
63
|
+
.will-root {
|
|
64
|
+
position: absolute;
|
|
65
|
+
padding: 40px 10px;
|
|
66
|
+
top: 15px;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
.will-filter-bar-container {
|
|
63
70
|
margin-top: 20px;
|
|
64
71
|
padding: 30px 40px;
|
|
65
72
|
position: initial;
|
|
66
73
|
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
67
78
|
}
|
|
68
79
|
|
|
@@ -15,6 +15,7 @@ import { AgeCategoryType } from './FilterBarTypes'
|
|
|
15
15
|
import './FilterBar.css'
|
|
16
16
|
import '../../themes/Default.css'
|
|
17
17
|
import i18n from '../../i18n'
|
|
18
|
+
import CloseButton from './components/close-button/CloseButton'
|
|
18
19
|
|
|
19
20
|
interface FilterBarProps {
|
|
20
21
|
vendor?: string
|
|
@@ -25,7 +26,7 @@ interface FilterBarProps {
|
|
|
25
26
|
export default function FilterBar({
|
|
26
27
|
vendor,
|
|
27
28
|
language,
|
|
28
|
-
ageCategories,
|
|
29
|
+
ageCategories = ageCategoriesFallback,
|
|
29
30
|
}: FilterBarProps) {
|
|
30
31
|
const themeClass = useTheme({ vendor })
|
|
31
32
|
const [rerenderKey, setRerenderKey] = useState(0)
|
|
@@ -33,7 +34,6 @@ export default function FilterBar({
|
|
|
33
34
|
useEffect(() => {
|
|
34
35
|
i18n.changeLanguage(language)
|
|
35
36
|
|
|
36
|
-
// Trigger a re-render by updating the rerenderKey
|
|
37
37
|
setRerenderKey((prevKey) => prevKey + 1)
|
|
38
38
|
}, [language])
|
|
39
39
|
|
|
@@ -49,6 +49,7 @@ export default function FilterBar({
|
|
|
49
49
|
handleSelectedFilter,
|
|
50
50
|
handleSubmit,
|
|
51
51
|
updateGuestsCount,
|
|
52
|
+
handleResetFilters,
|
|
52
53
|
} = useFilterBar(ageCategories)
|
|
53
54
|
|
|
54
55
|
return (
|
|
@@ -88,6 +89,8 @@ export default function FilterBar({
|
|
|
88
89
|
style={fontWigthBold(selectedFilter === 4)}
|
|
89
90
|
/> */}
|
|
90
91
|
<SubmitButton onClick={handleSubmit} />
|
|
92
|
+
|
|
93
|
+
<CloseButton handleClose={handleResetFilters} />
|
|
91
94
|
</div>
|
|
92
95
|
|
|
93
96
|
{selectedFilter && (
|
|
@@ -121,3 +124,20 @@ export default function FilterBar({
|
|
|
121
124
|
const fontWigthBold = (input: boolean) => {
|
|
122
125
|
return { fontWeight: input ? 'bold' : 'initial' }
|
|
123
126
|
}
|
|
127
|
+
|
|
128
|
+
const ageCategoriesFallback = [
|
|
129
|
+
{
|
|
130
|
+
id: '1',
|
|
131
|
+
name: 'Adults',
|
|
132
|
+
minAge: null,
|
|
133
|
+
maxAge: 6,
|
|
134
|
+
minVal: 1,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: '2',
|
|
138
|
+
name: 'Kids',
|
|
139
|
+
minAge: 6,
|
|
140
|
+
maxAge: 17,
|
|
141
|
+
minVal: 0,
|
|
142
|
+
},
|
|
143
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.will-filter-bar-close-button {
|
|
2
|
+
width: auto;
|
|
3
|
+
height: auto;
|
|
4
|
+
background-color: var(--will-grey);
|
|
5
|
+
color: var(--will-white);
|
|
6
|
+
padding: 2px 7px;
|
|
7
|
+
border-radius: 50%;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
border: none;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
font-size: 25px;
|
|
13
|
+
margin-left: 15px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@media (max-width: 960px) {
|
|
17
|
+
.will-filter-bar-close-button {
|
|
18
|
+
min-height: 35px;
|
|
19
|
+
border-radius: 25px;
|
|
20
|
+
margin-left:0;
|
|
21
|
+
margin-bottom: 25px;
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IoIosCloseCircleOutline } from 'react-icons/io'
|
|
3
|
+
|
|
4
|
+
import './CloseButton.css'
|
|
5
|
+
|
|
6
|
+
interface CloseButtonPropsType {
|
|
7
|
+
handleClose: () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function CloseButton({ handleClose }: CloseButtonPropsType) {
|
|
11
|
+
return (
|
|
12
|
+
<button className="will-filter-bar-close-button" onClick={handleClose}>
|
|
13
|
+
<IoIosCloseCircleOutline />
|
|
14
|
+
</button>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -9,8 +9,6 @@ export default function useFilterBar(ageCategories: any) {
|
|
|
9
9
|
const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
|
|
10
10
|
|
|
11
11
|
const [categories, setCategories] = useState<number>(0)
|
|
12
|
-
|
|
13
|
-
//
|
|
14
12
|
const [ageCategoryCounts, setAgeCategoryCounts] = useState<AgeCategoryCount>(
|
|
15
13
|
{}
|
|
16
14
|
)
|
|
@@ -22,8 +20,6 @@ export default function useFilterBar(ageCategories: any) {
|
|
|
22
20
|
}))
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
23
|
useEffect(() => {
|
|
28
24
|
const urlSearchParams = new URLSearchParams(window.location.search)
|
|
29
25
|
|
|
@@ -82,6 +78,12 @@ export default function useFilterBar(ageCategories: any) {
|
|
|
82
78
|
}
|
|
83
79
|
}, [selectedFilter])
|
|
84
80
|
|
|
81
|
+
const handleResetFilters = () => {
|
|
82
|
+
setAgeCategoryCounts({})
|
|
83
|
+
handleSubmit()
|
|
84
|
+
setSelectedFilter(false)
|
|
85
|
+
}
|
|
86
|
+
|
|
85
87
|
return {
|
|
86
88
|
selectedFilter,
|
|
87
89
|
ageCategoryCounts,
|
|
@@ -93,7 +95,7 @@ export default function useFilterBar(ageCategories: any) {
|
|
|
93
95
|
setCategories,
|
|
94
96
|
handleSelectedFilter,
|
|
95
97
|
handleSubmit,
|
|
96
|
-
|
|
97
98
|
updateGuestsCount,
|
|
99
|
+
handleResetFilters,
|
|
98
100
|
}
|
|
99
101
|
}
|