willba-component-library 0.1.32 → 0.1.33
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/buttons/select-button/SelectButton.d.ts +1 -1
- package/lib/index.esm.js +130 -118
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +130 -118
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +130 -118
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +42 -4
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +6 -3
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +7 -8
- package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.css +1 -1
- package/src/locales/en/filterBar.json +2 -1
- package/src/locales/fi/filterBar.json +2 -1
package/package.json
CHANGED
|
@@ -88,6 +88,27 @@ export default function FilterBar({
|
|
|
88
88
|
}
|
|
89
89
|
}, [selectedFilter])
|
|
90
90
|
|
|
91
|
+
const renderDates =
|
|
92
|
+
calendarRange?.to && calendarRange?.from
|
|
93
|
+
? `${format(calendarRange.from, 'dd.MM.yyyy')} -
|
|
94
|
+
${format(calendarRange.to, 'dd.MM.yyyy')}`
|
|
95
|
+
: null
|
|
96
|
+
|
|
97
|
+
const renderGuests = Object.entries(ageCategoryCounts).reduce(
|
|
98
|
+
(acc, [key, value]) => {
|
|
99
|
+
const ageCategory = ageCategories.find(
|
|
100
|
+
(c) => c.id === key[key.length - 1]
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
if (ageCategory) {
|
|
104
|
+
acc += `${acc ? ' -' : ''} ${ageCategory.name}: ${value}`
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return acc
|
|
108
|
+
},
|
|
109
|
+
''
|
|
110
|
+
)
|
|
111
|
+
|
|
91
112
|
return (
|
|
92
113
|
<>
|
|
93
114
|
{selectedFilter && (
|
|
@@ -104,7 +125,10 @@ export default function FilterBar({
|
|
|
104
125
|
style={themePalette}
|
|
105
126
|
>
|
|
106
127
|
{!currentViewApply && (
|
|
107
|
-
<div
|
|
128
|
+
<div
|
|
129
|
+
className="will-filter-bar-tabs"
|
|
130
|
+
ref={!currentViewApply ? targetFilterBarRef : null}
|
|
131
|
+
>
|
|
108
132
|
<TabButton
|
|
109
133
|
label={t('tabs.events')}
|
|
110
134
|
onClick={() => setSelectedPath('/events')}
|
|
@@ -118,12 +142,24 @@ export default function FilterBar({
|
|
|
118
142
|
</div>
|
|
119
143
|
)}
|
|
120
144
|
|
|
121
|
-
<div
|
|
145
|
+
<div
|
|
146
|
+
className="will-filter-bar-header"
|
|
147
|
+
ref={currentViewApply ? targetFilterBarRef : null}
|
|
148
|
+
>
|
|
122
149
|
<SelectButton
|
|
123
150
|
label={t('calendar.label')}
|
|
124
|
-
description={
|
|
151
|
+
description={
|
|
152
|
+
renderDates
|
|
153
|
+
? renderDates
|
|
154
|
+
: selectedPath === '/rooms'
|
|
155
|
+
? t('calendar.roomsLabelPlaceholder')
|
|
156
|
+
: t('calendar.eventsLabelPlaceholder')
|
|
157
|
+
}
|
|
125
158
|
onClick={() => handleSelectedFilter(1)}
|
|
126
159
|
style={fontWeightBold(selectedFilter === 1)}
|
|
160
|
+
date={
|
|
161
|
+
calendarRange?.to ? format(calendarRange.to, 'dd.MM.yyyy') : null
|
|
162
|
+
}
|
|
127
163
|
/>
|
|
128
164
|
|
|
129
165
|
{selectedPath === '/rooms' && (
|
|
@@ -132,7 +168,9 @@ export default function FilterBar({
|
|
|
132
168
|
|
|
133
169
|
<SelectButton
|
|
134
170
|
label={t('guests.label')}
|
|
135
|
-
description={
|
|
171
|
+
description={
|
|
172
|
+
renderGuests ? renderGuests : t('guests.labelPlaceholder')
|
|
173
|
+
}
|
|
136
174
|
onClick={() => handleSelectedFilter(2)}
|
|
137
175
|
style={fontWeightBold(selectedFilter === 2)}
|
|
138
176
|
/>
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
|
|
26
26
|
@media (max-width: 960px) {
|
|
27
27
|
.will-filter-bar-select-button {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
padding: 15px 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.will-filter-bar-select-button:first-child {
|
|
32
|
+
padding: 0 0 15px 0;
|
|
33
|
+
}
|
|
31
34
|
|
|
32
35
|
.will-filter-bar-select-button .select-button-wrapper {
|
|
33
36
|
justify-content: center;
|
|
@@ -2,11 +2,17 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import './SelectButton.css'
|
|
4
4
|
|
|
5
|
+
type Props = {
|
|
6
|
+
label: string
|
|
7
|
+
onClick: () => void
|
|
8
|
+
style: Object
|
|
9
|
+
description: string
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
export default function SelectButton({
|
|
6
13
|
label,
|
|
7
14
|
onClick,
|
|
8
15
|
style,
|
|
9
|
-
date,
|
|
10
16
|
description,
|
|
11
17
|
}: any) {
|
|
12
18
|
return (
|
|
@@ -20,13 +26,6 @@ export default function SelectButton({
|
|
|
20
26
|
<p className="select-button-label">{label}</p>
|
|
21
27
|
<p className="select-button-description">{description}</p>
|
|
22
28
|
</div>
|
|
23
|
-
|
|
24
|
-
{!!date && (
|
|
25
|
-
<>
|
|
26
|
-
<span className="select-button-divider">|</span>
|
|
27
|
-
<span className="select-button-date"> {date}</span>
|
|
28
|
-
</>
|
|
29
|
-
)}
|
|
30
29
|
</span>
|
|
31
30
|
</button>
|
|
32
31
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"calendar": {
|
|
3
3
|
"label": "When",
|
|
4
|
-
"
|
|
4
|
+
"roomsLabelPlaceholder": "Add check-in and check-out",
|
|
5
|
+
"eventsLabelPlaceholder": "Add search dates",
|
|
5
6
|
"startDate": "Start date",
|
|
6
7
|
"endDate": "End date",
|
|
7
8
|
"title": "Calendar"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"calendar": {
|
|
3
3
|
"label": "Milloin",
|
|
4
|
-
"
|
|
4
|
+
"roomsLabelPlaceholder": "Lisää check-in ja check-out",
|
|
5
|
+
"eventsLabelPlaceholder": "Lisää aikaväli",
|
|
5
6
|
"startDate": "Alku",
|
|
6
7
|
"endDate": "Loppu",
|
|
7
8
|
"title": "Kalenteri"
|