willba-component-library 0.0.81 → 0.0.83

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -1,8 +1,9 @@
1
1
  .will-root {
2
2
  z-index: 99999;
3
3
  width: 100%;
4
- max-height: calc(100vh - 56px);
4
+ max-height: 100vh;
5
5
  position: relative;
6
+ overflow-y: auto;
6
7
  }
7
8
 
8
9
  .will-filter-bar {
@@ -36,7 +37,7 @@
36
37
  box-shadow: var(--will-box-shadow);
37
38
  }
38
39
 
39
- @media (max-width: 1024px) {
40
+ @media (max-width: 960px) {
40
41
  .will-filter-bar-header {
41
42
  flex-direction: column;
42
43
  padding: 20px;
@@ -58,11 +59,21 @@
58
59
  box-shadow: var(--will-box-shadow);
59
60
  }
60
61
 
61
- @media (max-width: 1024px) {
62
+ @media (max-width: 960px) {
63
+ .will-root {
64
+ position: absolute;
65
+ padding: 40px 10px;
66
+ top: 15px;
67
+ }
68
+
62
69
  .will-filter-bar-container {
63
70
  margin-top: 20px;
64
71
  padding: 30px 40px;
65
72
  position: initial;
66
73
  }
74
+
75
+
76
+
77
+
67
78
  }
68
79
 
@@ -15,6 +15,7 @@ import { AgeCategoryType } from './FilterBarTypes'
15
15
  import './FilterBar.css'
16
16
  import '../../themes/Default.css'
17
17
  import i18n from '../../i18n'
18
+ import CloseButton from './components/close-button/CloseButton'
18
19
 
19
20
  interface FilterBarProps {
20
21
  vendor?: string
@@ -25,7 +26,7 @@ interface FilterBarProps {
25
26
  export default function FilterBar({
26
27
  vendor,
27
28
  language,
28
- ageCategories,
29
+ ageCategories = ageCategoriesFallback,
29
30
  }: FilterBarProps) {
30
31
  const themeClass = useTheme({ vendor })
31
32
  const [rerenderKey, setRerenderKey] = useState(0)
@@ -33,7 +34,6 @@ export default function FilterBar({
33
34
  useEffect(() => {
34
35
  i18n.changeLanguage(language)
35
36
 
36
- // Trigger a re-render by updating the rerenderKey
37
37
  setRerenderKey((prevKey) => prevKey + 1)
38
38
  }, [language])
39
39
 
@@ -49,6 +49,7 @@ export default function FilterBar({
49
49
  handleSelectedFilter,
50
50
  handleSubmit,
51
51
  updateGuestsCount,
52
+ handleResetFilters,
52
53
  } = useFilterBar(ageCategories)
53
54
 
54
55
  return (
@@ -88,6 +89,8 @@ export default function FilterBar({
88
89
  style={fontWigthBold(selectedFilter === 4)}
89
90
  /> */}
90
91
  <SubmitButton onClick={handleSubmit} />
92
+
93
+ <CloseButton handleClose={handleResetFilters} />
91
94
  </div>
92
95
 
93
96
  {selectedFilter && (
@@ -121,3 +124,20 @@ export default function FilterBar({
121
124
  const fontWigthBold = (input: boolean) => {
122
125
  return { fontWeight: input ? 'bold' : 'initial' }
123
126
  }
127
+
128
+ const ageCategoriesFallback = [
129
+ {
130
+ id: '1',
131
+ name: 'Adults',
132
+ minAge: null,
133
+ maxAge: 6,
134
+ minVal: 1,
135
+ },
136
+ {
137
+ id: '2',
138
+ name: 'Kids',
139
+ minAge: 6,
140
+ maxAge: 17,
141
+ minVal: 0,
142
+ },
143
+ ]
@@ -65,7 +65,7 @@
65
65
  opacity: 1;
66
66
  }
67
67
 
68
- @media (max-width: 1024px) {
68
+ @media (max-width: 960px) {
69
69
  .will-calendar-filter-container .rdp-month .rdp-nav {
70
70
  border: none;
71
71
  border-radius: initial;
@@ -0,0 +1,25 @@
1
+ .will-filter-bar-close-button {
2
+ width: auto;
3
+ height: auto;
4
+ background-color: var(--will-grey);
5
+ color: var(--will-white);
6
+ padding: 2px 7px;
7
+ border-radius: 50%;
8
+ cursor: pointer;
9
+ border: none;
10
+ display: flex;
11
+ align-items: center;
12
+ font-size: 25px;
13
+ margin-left: 15px;
14
+ }
15
+
16
+ @media (max-width: 960px) {
17
+ .will-filter-bar-close-button {
18
+ min-height: 35px;
19
+ border-radius: 25px;
20
+ margin-left:0;
21
+ margin-bottom: 25px;
22
+ display: flex;
23
+ justify-content: center;
24
+ }
25
+ }
@@ -0,0 +1,16 @@
1
+ import React from 'react'
2
+ import { IoIosCloseCircleOutline } from 'react-icons/io'
3
+
4
+ import './CloseButton.css'
5
+
6
+ interface CloseButtonPropsType {
7
+ handleClose: () => void
8
+ }
9
+
10
+ export default function CloseButton({ handleClose }: CloseButtonPropsType) {
11
+ return (
12
+ <button className="will-filter-bar-close-button" onClick={handleClose}>
13
+ <IoIosCloseCircleOutline />
14
+ </button>
15
+ )
16
+ }
@@ -5,7 +5,7 @@
5
5
  background-color: #384265;
6
6
  }
7
7
 
8
- @media (max-width: 1024px) {
8
+ @media (max-width: 960px) {
9
9
  .will-filter-bar-divider {
10
10
  width: 100%;
11
11
  margin: 0 10px;
@@ -44,7 +44,7 @@
44
44
  cursor: pointer;
45
45
  }
46
46
 
47
- @media (max-width: 1024px) {
47
+ @media (max-width: 960px) {
48
48
 
49
49
  .will-guests-filter-inner {
50
50
  width: 100%;
@@ -21,7 +21,7 @@
21
21
  }
22
22
 
23
23
 
24
- @media (max-width: 1024px) {
24
+ @media (max-width: 960px) {
25
25
  .will-guests-filter-container {
26
26
  margin-top: 15px;
27
27
  }
@@ -10,7 +10,7 @@
10
10
  text-align: initial;
11
11
  }
12
12
 
13
- @media (max-width: 1024px) {
13
+ @media (max-width: 960px) {
14
14
  .will-filter-bar-select-button {
15
15
  margin: 15px 0;
16
16
  text-align: center;
@@ -19,7 +19,7 @@
19
19
  display: flex;
20
20
  }
21
21
 
22
- @media (max-width: 1024px) {
22
+ @media (max-width: 960px) {
23
23
  .will-filter-bar-submit-button {
24
24
  justify-content: center;
25
25
  margin-bottom: 25px;
@@ -9,8 +9,6 @@ export default function useFilterBar(ageCategories: any) {
9
9
  const [calendarRange, setCalendarRange] = useState<DateRange | undefined>()
10
10
 
11
11
  const [categories, setCategories] = useState<number>(0)
12
-
13
- //
14
12
  const [ageCategoryCounts, setAgeCategoryCounts] = useState<AgeCategoryCount>(
15
13
  {}
16
14
  )
@@ -22,8 +20,6 @@ export default function useFilterBar(ageCategories: any) {
22
20
  }))
23
21
  }
24
22
 
25
- //
26
-
27
23
  useEffect(() => {
28
24
  const urlSearchParams = new URLSearchParams(window.location.search)
29
25
 
@@ -82,6 +78,12 @@ export default function useFilterBar(ageCategories: any) {
82
78
  }
83
79
  }, [selectedFilter])
84
80
 
81
+ const handleResetFilters = () => {
82
+ setAgeCategoryCounts({})
83
+ handleSubmit()
84
+ setSelectedFilter(false)
85
+ }
86
+
85
87
  return {
86
88
  selectedFilter,
87
89
  ageCategoryCounts,
@@ -93,7 +95,7 @@ export default function useFilterBar(ageCategories: any) {
93
95
  setCategories,
94
96
  handleSelectedFilter,
95
97
  handleSubmit,
96
-
97
98
  updateGuestsCount,
99
+ handleResetFilters,
98
100
  }
99
101
  }