willba-component-library 0.1.13 → 0.1.15
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/.nvmrc +1 -1
- package/.storybook/main.ts +19 -19
- package/.storybook/preview.ts +15 -15
- package/README.md +57 -57
- package/lib/index.esm.js +13 -13
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +13 -13
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +13 -13
- package/lib/index.umd.js.map +1 -1
- package/package.json +51 -51
- package/prettier.config.js +6 -6
- package/rollup.config.mjs +61 -61
- package/src/components/Button/Button.stories.tsx +34 -34
- package/src/components/Button/Button.tsx +56 -56
- package/src/components/Button/button.css +29 -29
- package/src/components/Button/index.ts +1 -1
- package/src/components/FilterBar/FilterBar.css +83 -83
- package/src/components/FilterBar/FilterBar.stories.tsx +47 -47
- package/src/components/FilterBar/FilterBar.tsx +180 -180
- package/src/components/FilterBar/FilterBarTypes.ts +25 -25
- package/src/components/FilterBar/components/buttons/close-button/CloseButton.css +33 -33
- package/src/components/FilterBar/components/buttons/close-button/CloseButton.tsx +16 -16
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +36 -36
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +24 -24
- package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.css +27 -27
- package/src/components/FilterBar/components/buttons/submit-button/SubmitButton.tsx +18 -18
- package/src/components/FilterBar/components/calendar/Calendar.css +76 -76
- package/src/components/FilterBar/components/calendar/Calendar.tsx +52 -52
- package/src/components/FilterBar/components/categories/Categories.css +21 -21
- package/src/components/FilterBar/components/categories/Categories.tsx +41 -41
- package/src/components/FilterBar/components/divider/Divider.css +14 -14
- package/src/components/FilterBar/components/divider/Divider.tsx +7 -7
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.css +53 -53
- package/src/components/FilterBar/components/guests/GuestCount/GuestCount.tsx +51 -51
- package/src/components/FilterBar/components/guests/Guests.css +27 -27
- package/src/components/FilterBar/components/guests/Guests.tsx +38 -38
- package/src/components/FilterBar/hooks/useFilterBar.tsx +106 -106
- package/src/components/FilterBar/index.ts +1 -1
- package/src/i18n.ts +25 -25
- package/src/index.ts +4 -4
- package/src/locales/en/filterBar.json +20 -20
- package/src/locales/fi/filterBar.json +20 -20
- package/src/themes/Default.css +42 -42
- package/src/themes/useTheme.tsx +24 -24
- package/stories/Button.stories.ts +50 -50
- package/stories/Button.tsx +48 -48
- package/stories/Configure.mdx +364 -364
- package/stories/Header.stories.ts +27 -27
- package/stories/Header.tsx +56 -56
- package/stories/Page.stories.ts +29 -29
- package/stories/Page.tsx +73 -73
- package/stories/assets/accessibility.svg +4 -4
- package/stories/assets/discord.svg +15 -15
- package/stories/assets/github.svg +3 -3
- package/stories/assets/tutorials.svg +12 -12
- package/stories/assets/youtube.svg +4 -4
- package/stories/button.css +30 -30
- package/stories/header.css +32 -32
- package/stories/page.css +69 -69
- package/tsconfig.json +27 -27
- package/lib/components/FilterBar/components/close-button/CloseButton.d.ts +0 -7
- package/lib/components/FilterBar/components/select-button/SelectButton.d.ts +0 -3
- package/lib/components/FilterBar/components/submit-button/SubmitButton.d.ts +0 -3
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { GuestsCountPropsType } from '../../../FilterBarTypes'
|
|
4
|
-
|
|
5
|
-
import './GuestCount.css'
|
|
6
|
-
|
|
7
|
-
export default function GuestCount({
|
|
8
|
-
label,
|
|
9
|
-
id,
|
|
10
|
-
updateGuestsCount,
|
|
11
|
-
count,
|
|
12
|
-
minVal,
|
|
13
|
-
}: GuestsCountPropsType) {
|
|
14
|
-
const handleDecrement = () => {
|
|
15
|
-
if (count > minVal) {
|
|
16
|
-
updateGuestsCount(id, count - 1)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const handleIncrement = () => {
|
|
21
|
-
updateGuestsCount(id, count + 1)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<div className="will-guests-filter-inner">
|
|
26
|
-
<span className="will-guests-filter-label">{label}</span>
|
|
27
|
-
<div>
|
|
28
|
-
<button
|
|
29
|
-
className="will-guests-filter-button"
|
|
30
|
-
onClick={handleDecrement}
|
|
31
|
-
disabled={minVal && count < 2 ? true : false}
|
|
32
|
-
style={{
|
|
33
|
-
cursor:
|
|
34
|
-
minVal && count < 2
|
|
35
|
-
? 'initial'
|
|
36
|
-
: !minVal && count < 1
|
|
37
|
-
? 'initial'
|
|
38
|
-
: 'pointer',
|
|
39
|
-
paddingBottom: '4px',
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
-
|
|
43
|
-
</button>
|
|
44
|
-
<span className="will-guests-filter-count">{count}</span>
|
|
45
|
-
<button className="will-guests-filter-button" onClick={handleIncrement}>
|
|
46
|
-
+
|
|
47
|
-
</button>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { GuestsCountPropsType } from '../../../FilterBarTypes'
|
|
4
|
+
|
|
5
|
+
import './GuestCount.css'
|
|
6
|
+
|
|
7
|
+
export default function GuestCount({
|
|
8
|
+
label,
|
|
9
|
+
id,
|
|
10
|
+
updateGuestsCount,
|
|
11
|
+
count,
|
|
12
|
+
minVal,
|
|
13
|
+
}: GuestsCountPropsType) {
|
|
14
|
+
const handleDecrement = () => {
|
|
15
|
+
if (count > minVal) {
|
|
16
|
+
updateGuestsCount(id, count - 1)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const handleIncrement = () => {
|
|
21
|
+
updateGuestsCount(id, count + 1)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="will-guests-filter-inner">
|
|
26
|
+
<span className="will-guests-filter-label">{label}</span>
|
|
27
|
+
<div>
|
|
28
|
+
<button
|
|
29
|
+
className="will-guests-filter-button"
|
|
30
|
+
onClick={handleDecrement}
|
|
31
|
+
disabled={minVal && count < 2 ? true : false}
|
|
32
|
+
style={{
|
|
33
|
+
cursor:
|
|
34
|
+
minVal && count < 2
|
|
35
|
+
? 'initial'
|
|
36
|
+
: !minVal && count < 1
|
|
37
|
+
? 'initial'
|
|
38
|
+
: 'pointer',
|
|
39
|
+
paddingBottom: '4px',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
-
|
|
43
|
+
</button>
|
|
44
|
+
<span className="will-guests-filter-count">{count}</span>
|
|
45
|
+
<button className="will-guests-filter-button" onClick={handleIncrement}>
|
|
46
|
+
+
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
.will-filter-bar-guests {
|
|
2
|
-
text-align: initial;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.will-guests-filter-title {
|
|
6
|
-
font-size: 16px;
|
|
7
|
-
text-transform: uppercase;
|
|
8
|
-
margin: 10px 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.will-guests-filter-subtitle {
|
|
12
|
-
font-size: 15px;
|
|
13
|
-
font-weight: 500;
|
|
14
|
-
color:var(--will-text)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.will-guests-filter-container {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-wrap: wrap;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@media (max-width: 960px) {
|
|
25
|
-
.will-guests-filter-container {
|
|
26
|
-
margin-top: 15px;
|
|
27
|
-
}
|
|
1
|
+
.will-filter-bar-guests {
|
|
2
|
+
text-align: initial;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.will-guests-filter-title {
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
text-transform: uppercase;
|
|
8
|
+
margin: 10px 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.will-guests-filter-subtitle {
|
|
12
|
+
font-size: 15px;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
color:var(--will-text)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
.will-guests-filter-container {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@media (max-width: 960px) {
|
|
25
|
+
.will-guests-filter-container {
|
|
26
|
+
margin-top: 15px;
|
|
27
|
+
}
|
|
28
28
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
|
|
4
|
-
import GuestCount from './GuestCount/GuestCount'
|
|
5
|
-
import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
|
|
6
|
-
|
|
7
|
-
import './Guests.css'
|
|
8
|
-
|
|
9
|
-
export default function Guests({
|
|
10
|
-
ageCategories,
|
|
11
|
-
updateGuestsCount,
|
|
12
|
-
ageCategoryCounts,
|
|
13
|
-
}: GuestsPropsType) {
|
|
14
|
-
const { t } = useTranslation('filterBar')
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div className="will-filter-bar-guests">
|
|
18
|
-
<h3 className="will-guests-filter-title">{t('guests.title')}</h3>
|
|
19
|
-
<p className="will-guests-filter-subtitle">{t('guests.subtitle')}</p>
|
|
20
|
-
|
|
21
|
-
<div className="will-guests-filter-container">
|
|
22
|
-
{ageCategories?.map((category) => (
|
|
23
|
-
<GuestCount
|
|
24
|
-
key={category.id}
|
|
25
|
-
id={parseInt(category.id)}
|
|
26
|
-
label={category.name}
|
|
27
|
-
minVal={category.minVal}
|
|
28
|
-
updateGuestsCount={updateGuestsCount}
|
|
29
|
-
count={
|
|
30
|
-
(ageCategoryCounts as AgeCategoryCount)[category.id] ||
|
|
31
|
-
category.minVal
|
|
32
|
-
}
|
|
33
|
-
/>
|
|
34
|
-
))}
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
|
|
4
|
+
import GuestCount from './GuestCount/GuestCount'
|
|
5
|
+
import { AgeCategoryCount, GuestsPropsType } from '../../FilterBarTypes'
|
|
6
|
+
|
|
7
|
+
import './Guests.css'
|
|
8
|
+
|
|
9
|
+
export default function Guests({
|
|
10
|
+
ageCategories,
|
|
11
|
+
updateGuestsCount,
|
|
12
|
+
ageCategoryCounts,
|
|
13
|
+
}: GuestsPropsType) {
|
|
14
|
+
const { t } = useTranslation('filterBar')
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className="will-filter-bar-guests">
|
|
18
|
+
<h3 className="will-guests-filter-title">{t('guests.title')}</h3>
|
|
19
|
+
<p className="will-guests-filter-subtitle">{t('guests.subtitle')}</p>
|
|
20
|
+
|
|
21
|
+
<div className="will-guests-filter-container">
|
|
22
|
+
{ageCategories?.map((category) => (
|
|
23
|
+
<GuestCount
|
|
24
|
+
key={category.id}
|
|
25
|
+
id={parseInt(category.id)}
|
|
26
|
+
label={category.name}
|
|
27
|
+
minVal={category.minVal}
|
|
28
|
+
updateGuestsCount={updateGuestsCount}
|
|
29
|
+
count={
|
|
30
|
+
(ageCategoryCounts as AgeCategoryCount)[category.id] ||
|
|
31
|
+
category.minVal
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
))}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
import { DateRange } from 'react-day-picker'
|
|
3
|
-
import { format } from 'date-fns'
|
|
4
|
-
|
|
5
|
-
import { AgeCategoryCount, AgeCategoryType } from '../FilterBarTypes'
|
|
6
|
-
|
|
7
|
-
interface UseFilterBarPropsType {
|
|
8
|
-
redirectUrl: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
|
|
12
|
-
const [selectedFilter, setSelectedFilter] = useState<number | boolean>(false)
|
|
13
|
-
const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
|
|
14
|
-
|
|
15
|
-
const [categories, setCategories] = useState<number>(0)
|
|
16
|
-
const [ageCategoryCounts, setAgeCategoryCounts] = useState<AgeCategoryCount>(
|
|
17
|
-
{}
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const updateGuestsCount = (id: number, newCount: number) => {
|
|
21
|
-
setAgeCategoryCounts((prevCounts) => ({
|
|
22
|
-
...prevCounts,
|
|
23
|
-
[id]: newCount,
|
|
24
|
-
}))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
const urlSearchParams = new URLSearchParams(window.location.search)
|
|
29
|
-
|
|
30
|
-
const startDateParam = urlSearchParams.get('startDate')
|
|
31
|
-
const endDateParam = urlSearchParams.get('endDate')
|
|
32
|
-
const ageCategoryCountsParam = JSON.parse(
|
|
33
|
-
urlSearchParams.get('ageCategoryCounts') || '{}'
|
|
34
|
-
)
|
|
35
|
-
const parsedCategories = parseInt(
|
|
36
|
-
urlSearchParams.get('categories') || '0',
|
|
37
|
-
10
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
if (startDateParam && endDateParam) {
|
|
41
|
-
setCalendarRange({
|
|
42
|
-
from: new Date(startDateParam),
|
|
43
|
-
to: new Date(endDateParam),
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
setAgeCategoryCounts(ageCategoryCountsParam)
|
|
47
|
-
setCategories(parsedCategories)
|
|
48
|
-
}, [])
|
|
49
|
-
|
|
50
|
-
const handleSelectedFilter = (id: number | boolean) => {
|
|
51
|
-
setSelectedFilter(id)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const handleSubmit = () => {
|
|
55
|
-
const queryParams = new URLSearchParams()
|
|
56
|
-
|
|
57
|
-
const params = {
|
|
58
|
-
startDate: calendarRange?.from
|
|
59
|
-
? format(calendarRange.from, 'yyyy-MM-dd')
|
|
60
|
-
: '',
|
|
61
|
-
endDate: calendarRange?.to ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
62
|
-
categories,
|
|
63
|
-
//ageCategoryCounts: JSON.stringify(ageCategoryCounts),
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
for (const [key, value] of Object.entries(params)) {
|
|
67
|
-
if (value) {
|
|
68
|
-
queryParams.append(key, value.toString())
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
window.location.href = `${redirectUrl}${
|
|
73
|
-
queryParams ? `?${queryParams.toString()}` : ''
|
|
74
|
-
}`
|
|
75
|
-
handleSelectedFilter(false)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
document.body.style.overflow = selectedFilter ? 'hidden' : 'visible'
|
|
80
|
-
|
|
81
|
-
return () => {
|
|
82
|
-
document.body.style.overflow = 'visible'
|
|
83
|
-
}
|
|
84
|
-
}, [selectedFilter])
|
|
85
|
-
|
|
86
|
-
const handleResetFilters = () => {
|
|
87
|
-
setAgeCategoryCounts({})
|
|
88
|
-
handleSubmit()
|
|
89
|
-
setSelectedFilter(false)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
selectedFilter,
|
|
94
|
-
ageCategoryCounts,
|
|
95
|
-
categories,
|
|
96
|
-
calendarRange,
|
|
97
|
-
setCalendarRange,
|
|
98
|
-
setSelectedFilter,
|
|
99
|
-
setAgeCategoryCounts,
|
|
100
|
-
setCategories,
|
|
101
|
-
handleSelectedFilter,
|
|
102
|
-
handleSubmit,
|
|
103
|
-
updateGuestsCount,
|
|
104
|
-
handleResetFilters,
|
|
105
|
-
}
|
|
106
|
-
}
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { DateRange } from 'react-day-picker'
|
|
3
|
+
import { format } from 'date-fns'
|
|
4
|
+
|
|
5
|
+
import { AgeCategoryCount, AgeCategoryType } from '../FilterBarTypes'
|
|
6
|
+
|
|
7
|
+
interface UseFilterBarPropsType {
|
|
8
|
+
redirectUrl: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function useFilterBar({ redirectUrl }: UseFilterBarPropsType) {
|
|
12
|
+
const [selectedFilter, setSelectedFilter] = useState<number | boolean>(false)
|
|
13
|
+
const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
|
|
14
|
+
|
|
15
|
+
const [categories, setCategories] = useState<number>(0)
|
|
16
|
+
const [ageCategoryCounts, setAgeCategoryCounts] = useState<AgeCategoryCount>(
|
|
17
|
+
{}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const updateGuestsCount = (id: number, newCount: number) => {
|
|
21
|
+
setAgeCategoryCounts((prevCounts) => ({
|
|
22
|
+
...prevCounts,
|
|
23
|
+
[id]: newCount,
|
|
24
|
+
}))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const urlSearchParams = new URLSearchParams(window.location.search)
|
|
29
|
+
|
|
30
|
+
const startDateParam = urlSearchParams.get('startDate')
|
|
31
|
+
const endDateParam = urlSearchParams.get('endDate')
|
|
32
|
+
const ageCategoryCountsParam = JSON.parse(
|
|
33
|
+
urlSearchParams.get('ageCategoryCounts') || '{}'
|
|
34
|
+
)
|
|
35
|
+
const parsedCategories = parseInt(
|
|
36
|
+
urlSearchParams.get('categories') || '0',
|
|
37
|
+
10
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if (startDateParam && endDateParam) {
|
|
41
|
+
setCalendarRange({
|
|
42
|
+
from: new Date(startDateParam),
|
|
43
|
+
to: new Date(endDateParam),
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
setAgeCategoryCounts(ageCategoryCountsParam)
|
|
47
|
+
setCategories(parsedCategories)
|
|
48
|
+
}, [])
|
|
49
|
+
|
|
50
|
+
const handleSelectedFilter = (id: number | boolean) => {
|
|
51
|
+
setSelectedFilter(id)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const handleSubmit = () => {
|
|
55
|
+
const queryParams = new URLSearchParams()
|
|
56
|
+
|
|
57
|
+
const params = {
|
|
58
|
+
startDate: calendarRange?.from
|
|
59
|
+
? format(calendarRange.from, 'yyyy-MM-dd')
|
|
60
|
+
: '',
|
|
61
|
+
endDate: calendarRange?.to ? format(calendarRange.to, 'yyyy-MM-dd') : '',
|
|
62
|
+
categories,
|
|
63
|
+
//ageCategoryCounts: JSON.stringify(ageCategoryCounts),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (const [key, value] of Object.entries(params)) {
|
|
67
|
+
if (value) {
|
|
68
|
+
queryParams.append(key, value.toString())
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
window.location.href = `${redirectUrl}${
|
|
73
|
+
queryParams ? `?${queryParams.toString()}` : ''
|
|
74
|
+
}`
|
|
75
|
+
handleSelectedFilter(false)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
document.body.style.overflow = selectedFilter ? 'hidden' : 'visible'
|
|
80
|
+
|
|
81
|
+
return () => {
|
|
82
|
+
document.body.style.overflow = 'visible'
|
|
83
|
+
}
|
|
84
|
+
}, [selectedFilter])
|
|
85
|
+
|
|
86
|
+
const handleResetFilters = () => {
|
|
87
|
+
setAgeCategoryCounts({})
|
|
88
|
+
handleSubmit()
|
|
89
|
+
setSelectedFilter(false)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
selectedFilter,
|
|
94
|
+
ageCategoryCounts,
|
|
95
|
+
categories,
|
|
96
|
+
calendarRange,
|
|
97
|
+
setCalendarRange,
|
|
98
|
+
setSelectedFilter,
|
|
99
|
+
setAgeCategoryCounts,
|
|
100
|
+
setCategories,
|
|
101
|
+
handleSelectedFilter,
|
|
102
|
+
handleSubmit,
|
|
103
|
+
updateGuestsCount,
|
|
104
|
+
handleResetFilters,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from "./FilterBar";
|
|
1
|
+
export { default } from "./FilterBar";
|
package/src/i18n.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import i18n from 'i18next'
|
|
2
|
-
import { initReactI18next } from 'react-i18next'
|
|
3
|
-
|
|
4
|
-
import enFilterBar from './locales/en/filterBar.json'
|
|
5
|
-
import fiFilterBar from './locales/fi/filterBar.json'
|
|
6
|
-
|
|
7
|
-
const urlParams =
|
|
8
|
-
typeof window !== 'undefined'
|
|
9
|
-
? new URLSearchParams(window.location.search)
|
|
10
|
-
: null
|
|
11
|
-
const localeFromUrl = urlParams?.get('locale') || 'fi'
|
|
12
|
-
|
|
13
|
-
i18n.use(initReactI18next).init({
|
|
14
|
-
resources: {
|
|
15
|
-
en: { filterBar: enFilterBar },
|
|
16
|
-
fi: { filterBar: fiFilterBar },
|
|
17
|
-
},
|
|
18
|
-
lng: localeFromUrl,
|
|
19
|
-
fallbackLng: 'fi',
|
|
20
|
-
interpolation: {
|
|
21
|
-
escapeValue: false,
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export default i18n
|
|
1
|
+
import i18n from 'i18next'
|
|
2
|
+
import { initReactI18next } from 'react-i18next'
|
|
3
|
+
|
|
4
|
+
import enFilterBar from './locales/en/filterBar.json'
|
|
5
|
+
import fiFilterBar from './locales/fi/filterBar.json'
|
|
6
|
+
|
|
7
|
+
const urlParams =
|
|
8
|
+
typeof window !== 'undefined'
|
|
9
|
+
? new URLSearchParams(window.location.search)
|
|
10
|
+
: null
|
|
11
|
+
const localeFromUrl = urlParams?.get('locale') || 'fi'
|
|
12
|
+
|
|
13
|
+
i18n.use(initReactI18next).init({
|
|
14
|
+
resources: {
|
|
15
|
+
en: { filterBar: enFilterBar },
|
|
16
|
+
fi: { filterBar: fiFilterBar },
|
|
17
|
+
},
|
|
18
|
+
lng: localeFromUrl,
|
|
19
|
+
fallbackLng: 'fi',
|
|
20
|
+
interpolation: {
|
|
21
|
+
escapeValue: false,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export default i18n
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Button from './components/Button'
|
|
2
|
-
import FilterBar from './components/FilterBar'
|
|
3
|
-
|
|
4
|
-
export { Button, FilterBar }
|
|
1
|
+
import Button from './components/Button'
|
|
2
|
+
import FilterBar from './components/FilterBar'
|
|
3
|
+
|
|
4
|
+
export { Button, FilterBar }
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"calendar": {
|
|
3
|
-
"startDate": "Start date",
|
|
4
|
-
"endDate": "End date",
|
|
5
|
-
"title": "Calendar"
|
|
6
|
-
},
|
|
7
|
-
"guests": {
|
|
8
|
-
"label": "Guests",
|
|
9
|
-
"title": "Guests",
|
|
10
|
-
"subtitle": "Who's coming?",
|
|
11
|
-
"adultsLabel": "Adults",
|
|
12
|
-
"kidsLabel": "kids"
|
|
13
|
-
},
|
|
14
|
-
"categories": {
|
|
15
|
-
"label": "Categories",
|
|
16
|
-
"title": "Category"
|
|
17
|
-
},
|
|
18
|
-
"submit": {
|
|
19
|
-
"label": "Search"
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"calendar": {
|
|
3
|
+
"startDate": "Start date",
|
|
4
|
+
"endDate": "End date",
|
|
5
|
+
"title": "Calendar"
|
|
6
|
+
},
|
|
7
|
+
"guests": {
|
|
8
|
+
"label": "Guests",
|
|
9
|
+
"title": "Guests",
|
|
10
|
+
"subtitle": "Who's coming?",
|
|
11
|
+
"adultsLabel": "Adults",
|
|
12
|
+
"kidsLabel": "kids"
|
|
13
|
+
},
|
|
14
|
+
"categories": {
|
|
15
|
+
"label": "Categories",
|
|
16
|
+
"title": "Category"
|
|
17
|
+
},
|
|
18
|
+
"submit": {
|
|
19
|
+
"label": "Search"
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"calendar": {
|
|
3
|
-
"startDate": "Aloitus päivämäärä",
|
|
4
|
-
"endDate": "Päättymis päivämäärä",
|
|
5
|
-
"title": "Kalenteri"
|
|
6
|
-
},
|
|
7
|
-
"guests": {
|
|
8
|
-
"label": "Vieraat",
|
|
9
|
-
"title": "Vieraat",
|
|
10
|
-
"subtitle": "Kuka saapuu?",
|
|
11
|
-
"adultsLabel": "Aikuiset",
|
|
12
|
-
"kidsLabel": "lapset"
|
|
13
|
-
},
|
|
14
|
-
"categories": {
|
|
15
|
-
"label": "Kategoriat",
|
|
16
|
-
"title": "Kategoria"
|
|
17
|
-
},
|
|
18
|
-
"submit": {
|
|
19
|
-
"label": "Hae"
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"calendar": {
|
|
3
|
+
"startDate": "Aloitus päivämäärä",
|
|
4
|
+
"endDate": "Päättymis päivämäärä",
|
|
5
|
+
"title": "Kalenteri"
|
|
6
|
+
},
|
|
7
|
+
"guests": {
|
|
8
|
+
"label": "Vieraat",
|
|
9
|
+
"title": "Vieraat",
|
|
10
|
+
"subtitle": "Kuka saapuu?",
|
|
11
|
+
"adultsLabel": "Aikuiset",
|
|
12
|
+
"kidsLabel": "lapset"
|
|
13
|
+
},
|
|
14
|
+
"categories": {
|
|
15
|
+
"label": "Kategoriat",
|
|
16
|
+
"title": "Kategoria"
|
|
17
|
+
},
|
|
18
|
+
"submit": {
|
|
19
|
+
"label": "Hae"
|
|
20
|
+
}
|
|
21
21
|
}
|