willba-component-library 0.1.55 → 0.1.56
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/FilterBar.d.ts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.esm.js +13 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +13 -5
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +13 -5
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBar.css +5 -0
- package/src/components/FilterBar/FilterBar.stories.tsx +1 -0
- package/src/components/FilterBar/FilterBar.tsx +18 -2
- package/src/components/FilterBar/components/buttons/select-button/SelectButton.css +6 -2
- package/src/components/FilterBar/utils/parseGuests.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
|
|
4
4
|
import useTheme, { Palette } from '../../themes/useTheme'
|
|
@@ -38,6 +38,7 @@ export type FilterBarProps = {
|
|
|
38
38
|
palette?: Palette
|
|
39
39
|
currentViewApply?: string
|
|
40
40
|
onSubmit?: ((val: Filters) => void) | null
|
|
41
|
+
fullWidth: boolean
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export default function FilterBar({
|
|
@@ -47,6 +48,7 @@ export default function FilterBar({
|
|
|
47
48
|
palette,
|
|
48
49
|
currentViewApply,
|
|
49
50
|
onSubmit,
|
|
51
|
+
fullWidth,
|
|
50
52
|
}: FilterBarProps) {
|
|
51
53
|
const themePalette = useTheme({ palette })
|
|
52
54
|
|
|
@@ -87,12 +89,26 @@ export default function FilterBar({
|
|
|
87
89
|
// Handle close filter section
|
|
88
90
|
const { filtersRef } = useCloseFilterSection({ handleSelectedFilter })
|
|
89
91
|
|
|
92
|
+
// Display component after fully loaded
|
|
93
|
+
const [initialRenderComplete, setInitialRenderComplete] =
|
|
94
|
+
useState<boolean>(false)
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
setInitialRenderComplete(true)
|
|
98
|
+
}, [])
|
|
99
|
+
|
|
100
|
+
if (!initialRenderComplete) return
|
|
101
|
+
//----/----
|
|
102
|
+
|
|
90
103
|
// Parsed data for filter section description
|
|
91
104
|
const parsedDates = parseDates({ calendarRange })
|
|
92
105
|
const parsedGuests = parseGuests({ ageCategoryCounts, ageCategories })
|
|
93
106
|
|
|
94
107
|
return (
|
|
95
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
className={`will-root ${fullWidth ? 'is-full-width' : ''}`}
|
|
110
|
+
style={themePalette}
|
|
111
|
+
>
|
|
96
112
|
{!currentViewApply && (
|
|
97
113
|
<div
|
|
98
114
|
className="will-filter-bar-tabs"
|
|
@@ -31,8 +31,12 @@
|
|
|
31
31
|
opacity: 0.8;
|
|
32
32
|
|
|
33
33
|
white-space: nowrap;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.will-root.is-full-width .will-filter-bar-select-button .select-button-description {
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
text-overflow: ellipsis;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
.will-filter-bar-select-button .select-button-label.active,
|
|
@@ -10,7 +10,7 @@ export const parseGuests = ({ ageCategoryCounts, ageCategories }: Props) =>
|
|
|
10
10
|
const ageCategory = ageCategories.find((c) => c.id === key[key.length - 1])
|
|
11
11
|
|
|
12
12
|
if (ageCategory && value) {
|
|
13
|
-
acc += `${acc ? '
|
|
13
|
+
acc += `${acc ? ' |' : ''} ${
|
|
14
14
|
ageCategory.name
|
|
15
15
|
}: <span style="display: inline-block; width: 21px">${value}</span>`
|
|
16
16
|
}
|