willba-component-library 0.1.21 → 0.1.23
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/FilterBarTypes.d.ts +2 -2
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +1 -1
- package/lib/components/FilterBar/components/guests/GuestCount/GuestCount.d.ts +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.esm.js +149 -150
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +149 -150
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +149 -150
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +13 -14
- package/src/components/FilterBar/FilterBar.stories.tsx +15 -13
- package/src/components/FilterBar/FilterBar.tsx +13 -36
- package/src/components/FilterBar/FilterBarTypes.ts +2 -2
- package/src/components/FilterBar/components/buttons/close-button/CloseButton.css +2 -2
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +9 -3
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +11 -2
- package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.css +1 -1
- package/src/components/FilterBar/components/buttons/tab-button/TabButton.css +9 -17
- package/src/components/FilterBar/components/calendar/Calendar.css +7 -3
- package/src/components/FilterBar/components/calendar/Calendar.tsx +19 -12
- package/src/components/FilterBar/components/divider/Divider.css +1 -2
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +13 -11
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +10 -5
- package/src/components/FilterBar/components/guests/Guests.css +8 -3
- package/src/components/FilterBar/components/guests/Guests.tsx +2 -5
- package/src/components/FilterBar/hooks/useFilterBar.tsx +2 -2
- package/src/themes/Default.css +1 -1
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.will-filter-bar-underlay {
|
|
15
|
-
background-color:
|
|
15
|
+
background-color: transparent;
|
|
16
16
|
position: absolute;
|
|
17
17
|
/* top:0; */
|
|
18
18
|
left: 0;
|
|
@@ -30,30 +30,30 @@
|
|
|
30
30
|
.will-filter-bar-tabs {
|
|
31
31
|
display: flex;
|
|
32
32
|
align-items: center;
|
|
33
|
-
|
|
33
|
+
justify-content: center;
|
|
34
34
|
position: relative;
|
|
35
35
|
z-index: 222;
|
|
36
|
+
background: transparent;
|
|
37
|
+
padding: 10px;
|
|
38
|
+
gap: 10px
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/* Header */
|
|
39
42
|
.will-filter-bar-header {
|
|
40
43
|
display: flex;
|
|
41
44
|
justify-content: space-between;
|
|
42
|
-
padding: 10px
|
|
45
|
+
padding: 10px;
|
|
43
46
|
position: relative;
|
|
44
47
|
z-index: 222;
|
|
45
|
-
|
|
46
|
-
|
|
47
48
|
border-radius: 40px;
|
|
48
|
-
|
|
49
|
-
background-color: var(--will-white);
|
|
50
|
-
|
|
49
|
+
background-color: var(--will-white);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
@media (max-width: 960px) {
|
|
54
53
|
.will-filter-bar-header {
|
|
55
54
|
flex-direction: column;
|
|
56
55
|
padding: 20px;
|
|
56
|
+
border-radius: 25px;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -62,13 +62,11 @@
|
|
|
62
62
|
.will-filter-bar-container {
|
|
63
63
|
background-color: var(--will-white);
|
|
64
64
|
min-height: 100px;
|
|
65
|
-
|
|
66
|
-
padding: 90px 40px 30px 40px;
|
|
65
|
+
padding: 40px 20px ;
|
|
67
66
|
position: absolute;
|
|
68
|
-
top:
|
|
67
|
+
top: 125px;
|
|
69
68
|
z-index: 111;
|
|
70
69
|
border-radius: 25px;
|
|
71
|
-
width: -webkit-fill-available;
|
|
72
70
|
box-shadow: var(--will-box-shadow);
|
|
73
71
|
}
|
|
74
72
|
|
|
@@ -81,8 +79,9 @@
|
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
.will-filter-bar-container {
|
|
84
|
-
margin-top:
|
|
85
|
-
|
|
82
|
+
margin-top: 10px;
|
|
83
|
+
top:0;
|
|
84
|
+
padding: 30px 20px;
|
|
86
85
|
position: relative;
|
|
87
86
|
}
|
|
88
87
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
|
|
2
4
|
import FilterBar from './FilterBar'
|
|
3
5
|
|
|
4
|
-
// Default metadata of the story https://storybook.js.org/docs/react/api/csf#default-export
|
|
5
6
|
const meta: Meta<typeof FilterBar> = {
|
|
6
7
|
title: 'Components/FilterBar',
|
|
7
8
|
component: FilterBar,
|
|
@@ -9,7 +10,6 @@ const meta: Meta<typeof FilterBar> = {
|
|
|
9
10
|
|
|
10
11
|
export default meta
|
|
11
12
|
|
|
12
|
-
// The story type for the component https://storybook.js.org/docs/react/api/csf#named-story-exports
|
|
13
13
|
type Story = StoryObj<typeof FilterBar>
|
|
14
14
|
|
|
15
15
|
export const Primary: Story = {
|
|
@@ -18,25 +18,22 @@ export const Primary: Story = {
|
|
|
18
18
|
redirectUrl: '',
|
|
19
19
|
ageCategories: [
|
|
20
20
|
{
|
|
21
|
-
id: '
|
|
21
|
+
id: '2',
|
|
22
22
|
name: 'Alle 6 vuotiaat',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
minVal: 1,
|
|
23
|
+
minVal: 0,
|
|
24
|
+
sortOrder: 3,
|
|
26
25
|
},
|
|
27
26
|
{
|
|
28
|
-
id: '
|
|
27
|
+
id: '3',
|
|
29
28
|
name: '6-16 vuotiaat',
|
|
30
|
-
minAge: 6,
|
|
31
|
-
maxAge: 17,
|
|
32
29
|
minVal: 0,
|
|
30
|
+
sortOrder: 2,
|
|
33
31
|
},
|
|
34
32
|
{
|
|
35
|
-
id: '
|
|
33
|
+
id: '1',
|
|
36
34
|
name: 'Aikuiset',
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
minVal: 0,
|
|
35
|
+
minVal: 2,
|
|
36
|
+
sortOrder: 1,
|
|
40
37
|
},
|
|
41
38
|
],
|
|
42
39
|
palette: {
|
|
@@ -44,4 +41,9 @@ export const Primary: Story = {
|
|
|
44
41
|
secondary: '',
|
|
45
42
|
},
|
|
46
43
|
},
|
|
44
|
+
render: (args) => (
|
|
45
|
+
<div style={{ background: 'grey', padding: '30px', height: '100vh' }}>
|
|
46
|
+
<FilterBar {...args} />
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
47
49
|
}
|
|
@@ -42,6 +42,7 @@ export default function FilterBar({
|
|
|
42
42
|
|
|
43
43
|
setRerenderKey((prevKey) => prevKey + 1)
|
|
44
44
|
}, [language])
|
|
45
|
+
|
|
45
46
|
const { t } = useTranslation('filterBar')
|
|
46
47
|
|
|
47
48
|
// Filters
|
|
@@ -104,42 +105,20 @@ export default function FilterBar({
|
|
|
104
105
|
|
|
105
106
|
<div className="will-filter-bar-header">
|
|
106
107
|
<SelectButton
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
label={'When'}
|
|
109
|
+
description={'Add Check-in and -out'}
|
|
109
110
|
onClick={() => handleSelectedFilter(1)}
|
|
110
|
-
|
|
111
|
-
calendarRange?.from
|
|
112
|
-
? format(calendarRange.from, 'dd.MM.yyyy')
|
|
113
|
-
: null
|
|
114
|
-
}
|
|
111
|
+
style={fontWeightBold(selectedFilter === 1)}
|
|
115
112
|
/>
|
|
116
113
|
|
|
117
114
|
<Divider />
|
|
118
|
-
|
|
119
115
|
<SelectButton
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
label={'Who'}
|
|
117
|
+
description={'Add Guests'}
|
|
122
118
|
onClick={() => handleSelectedFilter(2)}
|
|
123
|
-
|
|
124
|
-
calendarRange?.to ? format(calendarRange.to, 'dd.MM.yyyy') : null
|
|
125
|
-
}
|
|
119
|
+
style={fontWeightBold(selectedFilter === 2)}
|
|
126
120
|
/>
|
|
127
121
|
|
|
128
|
-
{/* TODO - Add strapi settings to show or hide filter sections */}
|
|
129
|
-
{/* <Divider />
|
|
130
|
-
<SelectButton
|
|
131
|
-
label={t('guests.label')}
|
|
132
|
-
onClick={() => handleSelectedFilter(3)}
|
|
133
|
-
style={fontWeightBold(selectedFilter === 3)}
|
|
134
|
-
/> */}
|
|
135
|
-
|
|
136
|
-
{/* <Divider />
|
|
137
|
-
<SelectButton
|
|
138
|
-
label={t('categories.label')}
|
|
139
|
-
onClick={() => handleSelectedFilter(4)}
|
|
140
|
-
style={fontWeightBold(selectedFilter === 4)}
|
|
141
|
-
/> */}
|
|
142
|
-
|
|
143
122
|
<SubmitButton onClick={handleSubmit} />
|
|
144
123
|
</div>
|
|
145
124
|
|
|
@@ -147,20 +126,20 @@ export default function FilterBar({
|
|
|
147
126
|
<div className="will-filter-bar-container">
|
|
148
127
|
<CloseButton handleClose={() => handleSelectedFilter(false)} />
|
|
149
128
|
|
|
150
|
-
{
|
|
129
|
+
{selectedFilter === 1 && (
|
|
151
130
|
<Calendar
|
|
152
131
|
calendarRange={calendarRange}
|
|
153
132
|
setCalendarRange={setCalendarRange}
|
|
154
133
|
/>
|
|
155
134
|
)}
|
|
156
|
-
{selectedFilter ===
|
|
135
|
+
{selectedFilter === 2 && (
|
|
157
136
|
<Guests
|
|
158
137
|
updateGuestsCount={updateGuestsCount}
|
|
159
138
|
ageCategories={ageCategories}
|
|
160
139
|
ageCategoryCounts={ageCategoryCounts}
|
|
161
140
|
/>
|
|
162
141
|
)}
|
|
163
|
-
{selectedFilter ===
|
|
142
|
+
{selectedFilter === 3 && (
|
|
164
143
|
<Categories
|
|
165
144
|
categories={categories}
|
|
166
145
|
setCategories={setCategories}
|
|
@@ -183,15 +162,13 @@ const AGE_CATEGORIES_FALLBACK = [
|
|
|
183
162
|
{
|
|
184
163
|
id: '1',
|
|
185
164
|
name: 'Adults',
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
minVal: 1,
|
|
165
|
+
sortOrder: 1,
|
|
166
|
+
minVal: 0,
|
|
189
167
|
},
|
|
190
168
|
{
|
|
191
169
|
id: '2',
|
|
192
170
|
name: 'Kids',
|
|
193
|
-
|
|
194
|
-
maxAge: 17,
|
|
171
|
+
sortOrder: 2,
|
|
195
172
|
minVal: 0,
|
|
196
173
|
},
|
|
197
174
|
]
|
|
@@ -5,9 +5,8 @@ export interface AgeCategoryCount {
|
|
|
5
5
|
export interface AgeCategoryType {
|
|
6
6
|
id: string
|
|
7
7
|
name: string
|
|
8
|
-
minAge: number | null
|
|
9
|
-
maxAge: number | null
|
|
10
8
|
minVal: number
|
|
9
|
+
sortOrder: number
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export interface GuestsPropsType {
|
|
@@ -22,4 +21,5 @@ export interface GuestsCountPropsType {
|
|
|
22
21
|
updateGuestsCount: (arg1: number, arg2: number) => void
|
|
23
22
|
count: number
|
|
24
23
|
minVal: number
|
|
24
|
+
sortOrder: number
|
|
25
25
|
}
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
height: auto;
|
|
4
4
|
background-color: transparent;
|
|
5
5
|
border: none;
|
|
6
|
-
padding:
|
|
6
|
+
padding: 0 20px;
|
|
7
7
|
border-radius: 20px;
|
|
8
8
|
cursor: pointer;
|
|
9
|
-
font-size:
|
|
9
|
+
font-size: 14px;
|
|
10
10
|
text-align: initial;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.will-filter-bar-select-button .select-button-description {
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
opacity: 0.4;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
.will-filter-bar-select-button .select-button-wrapper {
|
|
14
19
|
display: flex;
|
|
15
20
|
align-items: center;
|
|
@@ -20,7 +25,8 @@
|
|
|
20
25
|
|
|
21
26
|
@media (max-width: 960px) {
|
|
22
27
|
.will-filter-bar-select-button {
|
|
23
|
-
margin:
|
|
28
|
+
margin: 5px 0;
|
|
29
|
+
padding: 10px 20px;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
.will-filter-bar-select-button .select-button-wrapper {
|
|
@@ -2,7 +2,13 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import './SelectButton.css'
|
|
4
4
|
|
|
5
|
-
export default function SelectButton({
|
|
5
|
+
export default function SelectButton({
|
|
6
|
+
label,
|
|
7
|
+
onClick,
|
|
8
|
+
style,
|
|
9
|
+
date,
|
|
10
|
+
description,
|
|
11
|
+
}: any) {
|
|
6
12
|
return (
|
|
7
13
|
<button
|
|
8
14
|
className="will-filter-bar-select-button"
|
|
@@ -10,7 +16,10 @@ export default function SelectButton({ label, onClick, style, date }: any) {
|
|
|
10
16
|
style={style}
|
|
11
17
|
>
|
|
12
18
|
<span className="select-button-wrapper">
|
|
13
|
-
<
|
|
19
|
+
<div>
|
|
20
|
+
<p className="select-button-label">{label}</p>
|
|
21
|
+
<p className="select-button-description">{description}</p>
|
|
22
|
+
</div>
|
|
14
23
|
|
|
15
24
|
{!!date && (
|
|
16
25
|
<>
|
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
.will-filter-bar-tab-button {
|
|
2
2
|
width: auto;
|
|
3
3
|
height: auto;
|
|
4
|
-
padding: 10px
|
|
4
|
+
padding: 10px 20px;
|
|
5
5
|
cursor: pointer;
|
|
6
6
|
border: none;
|
|
7
7
|
white-space: nowrap;
|
|
8
|
-
|
|
9
|
-
font-size: 12px;
|
|
8
|
+
font-size: 16px;
|
|
10
9
|
display: flex;
|
|
11
10
|
align-items: center;
|
|
12
|
-
|
|
13
|
-
border-top: none;
|
|
14
|
-
background-color: var(--will-transparent-white);
|
|
11
|
+
background-color: transparent;
|
|
15
12
|
user-select: none;
|
|
16
13
|
font-weight: 600;
|
|
14
|
+
border-radius: 50px;
|
|
15
|
+
color: var(--will-white)
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
border-left: none;
|
|
21
|
-
} */
|
|
22
|
-
|
|
18
|
+
|
|
23
19
|
.will-filter-bar-tab-button:hover {
|
|
24
|
-
background-color: var(--will-white);
|
|
20
|
+
background-color: var(--will-transparent-white);
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
.will-filter-bar-tab-button.active {
|
|
28
|
-
background-color: var(--will-white);
|
|
29
|
-
|
|
24
|
+
background-color: var(--will-transparent-white);
|
|
25
|
+
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
29
|
/* @media (max-width: 960px) {
|
|
38
30
|
.will-filter-bar-tab-button {
|
|
39
31
|
justify-content: center;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* .will-filter-bar-calendar {} */
|
|
2
|
-
|
|
3
1
|
.will-calendar-filter-header {
|
|
4
2
|
padding: 15px 0;
|
|
5
3
|
border-bottom: 1px solid var(--will-grey);
|
|
@@ -15,11 +13,11 @@
|
|
|
15
13
|
.will-calendar-filter-container {
|
|
16
14
|
display: flex;
|
|
17
15
|
justify-content: center;
|
|
18
|
-
padding-top: 20px;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
/* Calendar overrides */
|
|
22
19
|
|
|
20
|
+
|
|
23
21
|
.will-calendar-filter-container .DayPicker {
|
|
24
22
|
font-size: 25px; /* Adjust this value to make the DayPicker bigger */
|
|
25
23
|
}
|
|
@@ -65,6 +63,12 @@
|
|
|
65
63
|
opacity: 1;
|
|
66
64
|
}
|
|
67
65
|
|
|
66
|
+
.my-today:not(.rdp-day_selected) {
|
|
67
|
+
font-weight: 700;
|
|
68
|
+
opacity: 1;
|
|
69
|
+
color: var(--will-primary);
|
|
70
|
+
}
|
|
71
|
+
|
|
68
72
|
@media (max-width: 960px) {
|
|
69
73
|
.will-calendar-filter-container .rdp-month .rdp-nav {
|
|
70
74
|
border: none;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
//import { useTranslation } from 'react-i18next'
|
|
3
2
|
import { DateRange, DayPicker } from 'react-day-picker'
|
|
4
|
-
import { addDays } from 'date-fns'
|
|
3
|
+
import { addDays, startOfDay, addMonths } from 'date-fns'
|
|
5
4
|
import { useMediaQuery } from 'react-responsive'
|
|
6
5
|
|
|
7
6
|
import 'react-day-picker/dist/style.css'
|
|
@@ -12,21 +11,20 @@ interface CalendarPropsType {
|
|
|
12
11
|
setCalendarRange: (range: DateRange | undefined) => void
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
const currentMonth = new Date()
|
|
16
|
-
|
|
17
14
|
export default function Calendar({
|
|
18
15
|
calendarRange,
|
|
19
16
|
setCalendarRange,
|
|
20
17
|
}: CalendarPropsType) {
|
|
21
|
-
//const { t } = useTranslation('filterBar')
|
|
22
18
|
const isTablet = useMediaQuery({ maxWidth: 960 })
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const today = startOfDay(new Date())
|
|
21
|
+
|
|
22
|
+
const disabledDays = [
|
|
23
|
+
{
|
|
24
|
+
from: addDays(today, -2),
|
|
25
|
+
to: addDays(today, -50),
|
|
26
|
+
},
|
|
27
|
+
]
|
|
30
28
|
|
|
31
29
|
useEffect(() => {
|
|
32
30
|
if (!calendarRange) setCalendarRange(undefined)
|
|
@@ -44,9 +42,18 @@ export default function Calendar({
|
|
|
44
42
|
showOutsideDays
|
|
45
43
|
numberOfMonths={!isTablet ? 2 : 1}
|
|
46
44
|
weekStartsOn={1}
|
|
47
|
-
defaultMonth={currentMonth}
|
|
48
45
|
selected={calendarRange}
|
|
49
46
|
onSelect={setCalendarRange}
|
|
47
|
+
modifiersClassNames={{
|
|
48
|
+
today: 'my-today',
|
|
49
|
+
}}
|
|
50
|
+
modifiersStyles={{
|
|
51
|
+
disabled: { opacity: '0.2' },
|
|
52
|
+
}}
|
|
53
|
+
captionLayout="dropdown-buttons"
|
|
54
|
+
defaultMonth={today}
|
|
55
|
+
disabled={disabledDays}
|
|
56
|
+
fromMonth={today}
|
|
50
57
|
/>
|
|
51
58
|
</div>
|
|
52
59
|
</div>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
.will-filter-bar-divider {
|
|
2
2
|
width: 1px;
|
|
3
3
|
margin: 0 10px;
|
|
4
|
-
height: 35px;
|
|
5
4
|
background-color: #384265;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
@media (max-width: 960px) {
|
|
9
8
|
.will-filter-bar-divider {
|
|
10
|
-
width:
|
|
9
|
+
width: auto;
|
|
11
10
|
margin: 0 10px;
|
|
12
11
|
height: 1px;
|
|
13
12
|
background-color: #384265;
|
|
@@ -6,21 +6,18 @@
|
|
|
6
6
|
.will-guests-filter-inner {
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.will-guests-filter-inner {
|
|
9
|
+
justify-content: space-between;
|
|
12
10
|
margin-top: 30px;
|
|
13
|
-
margin-right: 50px;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
.will-guests-filter-label {
|
|
17
14
|
display: block;
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
margin-bottom: 10px;
|
|
20
17
|
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
.will-guests-filter-inner
|
|
20
|
+
.will-guests-filter-inner .will-guests-filter-counter {
|
|
24
21
|
display: flex;
|
|
25
22
|
align-items: center;
|
|
26
23
|
}
|
|
@@ -31,12 +28,13 @@
|
|
|
31
28
|
text-align: center;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
.will-guests-filter-button {
|
|
31
|
+
.will-guests-filter-counter-button {
|
|
35
32
|
border-radius: 50%;
|
|
36
33
|
border: none;
|
|
37
|
-
background-color:
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
background-color: transparent;
|
|
35
|
+
border: 1px solid var(--will-grey);
|
|
36
|
+
width: 30px;
|
|
37
|
+
height: 30px;
|
|
40
38
|
display: flex;
|
|
41
39
|
justify-content: center;
|
|
42
40
|
align-items: center;
|
|
@@ -44,6 +42,10 @@
|
|
|
44
42
|
cursor: pointer;
|
|
45
43
|
}
|
|
46
44
|
|
|
45
|
+
.will-guests-filter-counter-button:hover {
|
|
46
|
+
background-color: var(--will-onahau);
|
|
47
|
+
}
|
|
48
|
+
|
|
47
49
|
@media (max-width: 960px) {
|
|
48
50
|
|
|
49
51
|
.will-guests-filter-inner {
|
|
@@ -6,6 +6,7 @@ import './GuestCount.css'
|
|
|
6
6
|
|
|
7
7
|
export default function GuestCount({
|
|
8
8
|
label,
|
|
9
|
+
sortOrder,
|
|
9
10
|
id,
|
|
10
11
|
updateGuestsCount,
|
|
11
12
|
count,
|
|
@@ -22,11 +23,12 @@ export default function GuestCount({
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
|
-
<div className="will-guests-filter-inner">
|
|
26
|
-
<
|
|
27
|
-
|
|
26
|
+
<div className="will-guests-filter-inner" style={{ order: `${sortOrder}` }}>
|
|
27
|
+
<p className="will-guests-filter-label">{label}</p>
|
|
28
|
+
|
|
29
|
+
<div className="will-guests-filter-counter">
|
|
28
30
|
<button
|
|
29
|
-
className="will-guests-filter-button"
|
|
31
|
+
className="will-guests-filter-counter-button"
|
|
30
32
|
onClick={handleDecrement}
|
|
31
33
|
disabled={minVal && count < 2 ? true : false}
|
|
32
34
|
style={{
|
|
@@ -42,7 +44,10 @@ export default function GuestCount({
|
|
|
42
44
|
-
|
|
43
45
|
</button>
|
|
44
46
|
<span className="will-guests-filter-count">{count}</span>
|
|
45
|
-
<button
|
|
47
|
+
<button
|
|
48
|
+
className="will-guests-filter-counter-button"
|
|
49
|
+
onClick={handleIncrement}
|
|
50
|
+
>
|
|
46
51
|
+
|
|
47
52
|
</button>
|
|
48
53
|
</div>
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.will-guests-filter-title {
|
|
6
|
-
font-size:
|
|
7
|
-
text-transform: uppercase;
|
|
6
|
+
font-size: 22px;
|
|
8
7
|
margin: 10px 0;
|
|
9
8
|
}
|
|
10
9
|
|
|
@@ -17,11 +16,17 @@
|
|
|
17
16
|
|
|
18
17
|
.will-guests-filter-container {
|
|
19
18
|
display: flex;
|
|
20
|
-
flex-
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
min-width: 300px;
|
|
21
|
+
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
@media (max-width: 960px) {
|
|
26
|
+
.will-guests-filter-title {
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
.will-guests-filter-container {
|
|
26
31
|
margin-top: 15px;
|
|
27
32
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
2
|
|
|
4
3
|
import GuestCount from './GuestCount/GuestCount'
|
|
5
4
|
import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
|
|
@@ -11,12 +10,9 @@ export default function Guests({
|
|
|
11
10
|
updateGuestsCount,
|
|
12
11
|
ageCategoryCounts,
|
|
13
12
|
}: GuestsPropsType) {
|
|
14
|
-
const { t } = useTranslation('filterBar')
|
|
15
|
-
|
|
16
13
|
return (
|
|
17
14
|
<div className="will-filter-bar-guests">
|
|
18
|
-
<h3 className="will-guests-filter-title">
|
|
19
|
-
<p className="will-guests-filter-subtitle">{t('guests.subtitle')}</p>
|
|
15
|
+
<h3 className="will-guests-filter-title">Who's coming?</h3>
|
|
20
16
|
|
|
21
17
|
<div className="will-guests-filter-container">
|
|
22
18
|
{ageCategories?.map((category) => (
|
|
@@ -25,6 +21,7 @@ export default function Guests({
|
|
|
25
21
|
id={parseInt(category.id)}
|
|
26
22
|
label={category.name}
|
|
27
23
|
minVal={category.minVal}
|
|
24
|
+
sortOrder={category.sortOrder}
|
|
28
25
|
updateGuestsCount={updateGuestsCount}
|
|
29
26
|
count={
|
|
30
27
|
(ageCategoryCounts as AgeCategoryCount)[category.id] ||
|
|
@@ -22,7 +22,7 @@ export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
|
|
|
22
22
|
const updateGuestsCount = (id: number, newCount: number) => {
|
|
23
23
|
setAgeCategoryCounts((prevCounts) => ({
|
|
24
24
|
...prevCounts,
|
|
25
|
-
[id]: newCount,
|
|
25
|
+
[`guests-${id}`]: newCount,
|
|
26
26
|
}))
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -62,7 +62,7 @@ export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
|
|
|
62
62
|
: '',
|
|
63
63
|
endDate: calendarRange?.to ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
64
64
|
categories,
|
|
65
|
-
|
|
65
|
+
ageCategoryCounts: JSON.stringify(ageCategoryCounts),
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
for (const [key, value] of Object.entries(params)) {
|
package/src/themes/Default.css
CHANGED