willba-component-library 0.1.11 → 0.1.13
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/README.md +6 -6
- package/lib/components/FilterBar/FilterBar.d.ts +1 -1
- package/lib/components/FilterBar/components/buttons/close-button/CloseButton.d.ts +7 -0
- package/lib/components/FilterBar/components/buttons/select-button/SelectButton.d.ts +3 -0
- package/lib/components/FilterBar/components/buttons/submit-button/SubmitButton.d.ts +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +125 -116
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +125 -116
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +125 -116
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +2 -6
- package/src/components/FilterBar/FilterBar.tsx +22 -9
- package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.css +7 -4
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +36 -0
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.tsx +24 -0
- package/src/components/FilterBar/components/calendar/Calendar.tsx +4 -6
- package/src/components/FilterBar/components/select-button/SelectButton.css +0 -20
- package/src/components/FilterBar/components/select-button/SelectButton.tsx +0 -15
- /package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.tsx +0 -0
- /package/src/components/FilterBar/components/{submit-button → buttons/submit-button}/SubmitButton.css +0 -0
- /package/src/components/FilterBar/components/{submit-button → buttons/submit-button}/SubmitButton.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { format } from 'date-fns'
|
|
3
4
|
|
|
4
5
|
import Divider from './components/divider/Divider'
|
|
5
|
-
import SelectButton from './components/select-button/SelectButton'
|
|
6
|
-
import SubmitButton from './components/submit-button/SubmitButton'
|
|
6
|
+
import SelectButton from './components/buttons/select-button/SelectButton'
|
|
7
|
+
import SubmitButton from './components/buttons/submit-button/SubmitButton'
|
|
7
8
|
import Calendar from './components/calendar/Calendar'
|
|
8
9
|
import Guests from './components/guests/Guests'
|
|
9
10
|
import Categories from './components/categories/Categories'
|
|
@@ -14,7 +15,7 @@ import useFilterBar from './hooks/useFilterBar'
|
|
|
14
15
|
import './FilterBar.css'
|
|
15
16
|
import '../../themes/Default.css'
|
|
16
17
|
import i18n from '../../i18n'
|
|
17
|
-
import CloseButton from './components/close-button/CloseButton'
|
|
18
|
+
import CloseButton from './components/buttons/close-button/CloseButton'
|
|
18
19
|
import { AgeCategoryType } from './FilterBarTypes'
|
|
19
20
|
|
|
20
21
|
export interface FilterBarProps {
|
|
@@ -22,7 +23,7 @@ export interface FilterBarProps {
|
|
|
22
23
|
language?: string
|
|
23
24
|
ageCategories?: AgeCategoryType[]
|
|
24
25
|
redirectUrl: string
|
|
25
|
-
palette
|
|
26
|
+
palette?: Palette
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export default function FilterBar({
|
|
@@ -56,12 +57,16 @@ export default function FilterBar({
|
|
|
56
57
|
} = useFilterBar({ redirectUrl })
|
|
57
58
|
|
|
58
59
|
// Scroll in to view
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
const targetFilterBarRef = useRef<HTMLDivElement | null>(null)
|
|
60
62
|
useEffect(() => {
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
+
if (targetFilterBarRef.current && selectedFilter) {
|
|
64
|
+
window.scrollTo({
|
|
63
65
|
behavior: 'smooth',
|
|
64
|
-
|
|
66
|
+
top:
|
|
67
|
+
targetFilterBarRef.current.getBoundingClientRect().top -
|
|
68
|
+
document.body.getBoundingClientRect().top -
|
|
69
|
+
30,
|
|
65
70
|
})
|
|
66
71
|
}
|
|
67
72
|
}, [selectedFilter])
|
|
@@ -80,17 +85,25 @@ export default function FilterBar({
|
|
|
80
85
|
className={`will-root ${selectedFilter ? 'isMobileAbsolute' : ''}`}
|
|
81
86
|
style={themePalette}
|
|
82
87
|
>
|
|
83
|
-
<div className="will-filter-bar-header" ref={
|
|
88
|
+
<div className="will-filter-bar-header" ref={targetFilterBarRef}>
|
|
84
89
|
<SelectButton
|
|
85
90
|
style={fontWigthBold(selectedFilter === 1 || selectedFilter === 2)}
|
|
86
91
|
label={t('calendar.startDate')}
|
|
87
92
|
onClick={() => handleSelectedFilter(1)}
|
|
93
|
+
date={
|
|
94
|
+
calendarRange?.from
|
|
95
|
+
? format(calendarRange.from, 'dd-MM-yyyy')
|
|
96
|
+
: null
|
|
97
|
+
}
|
|
88
98
|
/>
|
|
89
99
|
<Divider />
|
|
90
100
|
<SelectButton
|
|
91
101
|
style={fontWigthBold(selectedFilter === 1 || selectedFilter === 2)}
|
|
92
102
|
label={t('calendar.endDate')}
|
|
93
103
|
onClick={() => handleSelectedFilter(2)}
|
|
104
|
+
date={
|
|
105
|
+
calendarRange?.to ? format(calendarRange.to, 'dd-MM-yyyy') : null
|
|
106
|
+
}
|
|
94
107
|
/>
|
|
95
108
|
|
|
96
109
|
{/* TODO - Add strapi settings to show or hide filter sections */}
|
package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.css
RENAMED
|
@@ -10,17 +10,20 @@
|
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
font-size: 23px;
|
|
13
|
-
display: none;
|
|
13
|
+
/* display: none; */
|
|
14
14
|
|
|
15
15
|
position: absolute;
|
|
16
|
-
top:
|
|
17
|
-
right:
|
|
16
|
+
top: 80px;
|
|
17
|
+
right: 20px;
|
|
18
18
|
|
|
19
|
+
min-height: 35px;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
@media (max-width: 960px) {
|
|
22
23
|
.will-filter-bar-close-button {
|
|
23
|
-
|
|
24
|
+
top: 10px;
|
|
25
|
+
right: 10px;
|
|
26
|
+
|
|
24
27
|
border-radius: 25px;
|
|
25
28
|
margin-left:0;
|
|
26
29
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.will-filter-bar-select-button {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: auto;
|
|
4
|
+
background-color: transparent;
|
|
5
|
+
border: none;
|
|
6
|
+
padding: 10px 20px;
|
|
7
|
+
border-radius: 20px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
font-size: 15px;
|
|
10
|
+
text-align: initial;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.will-filter-bar-select-button .select-button-wrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (max-width: 960px) {
|
|
22
|
+
.will-filter-bar-select-button {
|
|
23
|
+
margin: 15px 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.will-filter-bar-select-button .select-button-wrapper {
|
|
27
|
+
justify-content: center;
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.will-filter-bar-select-button .select-button-divider {
|
|
32
|
+
display: none
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import './SelectButton.css'
|
|
4
|
+
|
|
5
|
+
export default function SelectButton({ label, onClick, style, date }: any) {
|
|
6
|
+
return (
|
|
7
|
+
<button
|
|
8
|
+
className="will-filter-bar-select-button"
|
|
9
|
+
onClick={onClick}
|
|
10
|
+
style={style}
|
|
11
|
+
>
|
|
12
|
+
<span className="select-button-wrapper">
|
|
13
|
+
<span className="select-button-label">{label}</span>
|
|
14
|
+
|
|
15
|
+
{!!date && (
|
|
16
|
+
<>
|
|
17
|
+
<span className="select-button-divider">|</span>
|
|
18
|
+
<span className="select-button-date"> {date}</span>
|
|
19
|
+
</>
|
|
20
|
+
)}
|
|
21
|
+
</span>
|
|
22
|
+
</button>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
2
|
+
//import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { DateRange, DayPicker } from 'react-day-picker'
|
|
4
4
|
import { addDays } from 'date-fns'
|
|
5
5
|
import { useMediaQuery } from 'react-responsive'
|
|
@@ -18,7 +18,7 @@ export default function Calendar({
|
|
|
18
18
|
calendarRange,
|
|
19
19
|
setCalendarRange,
|
|
20
20
|
}: CalendarPropsType) {
|
|
21
|
-
const { t } = useTranslation('filterBar')
|
|
21
|
+
//const { t } = useTranslation('filterBar')
|
|
22
22
|
const isTablet = useMediaQuery({ maxWidth: 960 })
|
|
23
23
|
|
|
24
24
|
const defaultCalendarSelected: DateRange = {
|
|
@@ -32,18 +32,16 @@ export default function Calendar({
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<div className="will-filter-bar-calendar">
|
|
35
|
-
<div className="will-calendar-filter-header">
|
|
35
|
+
{/* <div className="will-calendar-filter-header">
|
|
36
36
|
<h3 className="will-calendar-filter-title">{t('calendar.title')}</h3>
|
|
37
|
-
</div>
|
|
37
|
+
</div> */}
|
|
38
38
|
<div className="will-calendar-filter-container">
|
|
39
39
|
<DayPicker
|
|
40
40
|
id="will-calendar"
|
|
41
41
|
mode="range"
|
|
42
42
|
showOutsideDays
|
|
43
|
-
fixedWeeks
|
|
44
43
|
numberOfMonths={!isTablet ? 2 : 1}
|
|
45
44
|
weekStartsOn={1}
|
|
46
|
-
max={31}
|
|
47
45
|
defaultMonth={currentMonth}
|
|
48
46
|
selected={calendarRange}
|
|
49
47
|
onSelect={setCalendarRange}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.will-filter-bar-select-button {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: auto;
|
|
4
|
-
background-color: transparent;
|
|
5
|
-
border: none;
|
|
6
|
-
padding: 10px 20px;
|
|
7
|
-
border-radius: 20px;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
font-size: 15px;
|
|
10
|
-
text-align: initial;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@media (max-width: 960px) {
|
|
14
|
-
.will-filter-bar-select-button {
|
|
15
|
-
margin: 15px 0;
|
|
16
|
-
text-align: center;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import './SelectButton.css'
|
|
4
|
-
|
|
5
|
-
export default function SelectButton({ label, onClick, style }: any) {
|
|
6
|
-
return (
|
|
7
|
-
<button
|
|
8
|
-
className="will-filter-bar-select-button"
|
|
9
|
-
onClick={onClick}
|
|
10
|
-
style={style}
|
|
11
|
-
>
|
|
12
|
-
{label}
|
|
13
|
-
</button>
|
|
14
|
-
)
|
|
15
|
-
}
|
/package/src/components/FilterBar/components/{close-button → buttons/close-button}/CloseButton.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|