willba-component-library 0.1.31 → 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 +140 -123
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +140 -123
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +140 -123
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.tsx +44 -6
- 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/components/FilterBar/components/guests/Guests.tsx +3 -1
- package/src/locales/en/filterBar.json +6 -3
- package/src/locales/fi/filterBar.json +6 -3
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
|
-
label={'
|
|
124
|
-
description={
|
|
150
|
+
label={t('calendar.label')}
|
|
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' && (
|
|
@@ -131,8 +167,10 @@ export default function FilterBar({
|
|
|
131
167
|
<Divider />
|
|
132
168
|
|
|
133
169
|
<SelectButton
|
|
134
|
-
label={'
|
|
135
|
-
description={
|
|
170
|
+
label={t('guests.label')}
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
2
3
|
|
|
3
4
|
import GuestCount from './GuestCount/GuestCount'
|
|
4
5
|
import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
|
|
@@ -10,9 +11,10 @@ export default function Guests({
|
|
|
10
11
|
updateGuestsCount,
|
|
11
12
|
ageCategoryCounts,
|
|
12
13
|
}: GuestsPropsType) {
|
|
14
|
+
const { t } = useTranslation('filterBar')
|
|
13
15
|
return (
|
|
14
16
|
<div className="will-filter-bar-guests">
|
|
15
|
-
<h3 className="will-guests-filter-title">
|
|
17
|
+
<h3 className="will-guests-filter-title">{t('guests.title')}</h3>
|
|
16
18
|
|
|
17
19
|
<div className="will-guests-filter-container">
|
|
18
20
|
{ageCategories?.map((category) => (
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"calendar": {
|
|
3
|
+
"label": "When",
|
|
4
|
+
"roomsLabelPlaceholder": "Add check-in and check-out",
|
|
5
|
+
"eventsLabelPlaceholder": "Add search dates",
|
|
3
6
|
"startDate": "Start date",
|
|
4
7
|
"endDate": "End date",
|
|
5
8
|
"title": "Calendar"
|
|
6
9
|
},
|
|
7
10
|
"guests": {
|
|
8
|
-
"label": "
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"label": "Who",
|
|
12
|
+
"labelPlaceholder": "Add guests",
|
|
13
|
+
"title": "Who's coming?",
|
|
11
14
|
"adultsLabel": "Adults",
|
|
12
15
|
"kidsLabel": "kids"
|
|
13
16
|
},
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"calendar": {
|
|
3
|
+
"label": "Milloin",
|
|
4
|
+
"roomsLabelPlaceholder": "Lisää check-in ja check-out",
|
|
5
|
+
"eventsLabelPlaceholder": "Lisää aikaväli",
|
|
3
6
|
"startDate": "Alku",
|
|
4
7
|
"endDate": "Loppu",
|
|
5
8
|
"title": "Kalenteri"
|
|
6
9
|
},
|
|
7
10
|
"guests": {
|
|
8
|
-
"label": "
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"label": "Kuka",
|
|
12
|
+
"labelPlaceholder": "Lisää vieraat",
|
|
13
|
+
"title": "Ketkä ovat tulossa?",
|
|
11
14
|
"adultsLabel": "Aikuiset",
|
|
12
15
|
"kidsLabel": "lapset"
|
|
13
16
|
},
|