kupos-ui-components-lib 8.0.4 → 8.0.5
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/dist/KuposUIComponent.js +3 -0
- package/dist/components/CuponeraFilterBar/FilterBarDesktop.d.ts +4 -0
- package/dist/components/CuponeraFilterBar/FilterBarDesktop.js +111 -0
- package/dist/components/CuponeraFilterBar/FilterBarMobile.d.ts +4 -0
- package/dist/components/CuponeraFilterBar/FilterBarMobile.js +5 -0
- package/dist/components/CuponeraFilterBar/ResponsiveCuponeraFilterBar.d.ts +3 -0
- package/dist/components/CuponeraFilterBar/ResponsiveCuponeraFilterBar.js +10 -0
- package/dist/components/CuponeraFilterBar/index.d.ts +5 -0
- package/dist/components/CuponeraFilterBar/index.js +4 -0
- package/dist/components/CuponeraFilterBar/types.d.ts +22 -0
- package/dist/components/CuponeraFilterBar/types.js +1 -0
- package/dist/components/FilterBar/ServiceFilter.js +6 -1
- package/package.json +1 -1
- package/src/KuposUIComponent.tsx +10 -1
- package/src/components/CuponeraFilterBar/FilterBarDesktop.tsx +216 -0
- package/src/components/CuponeraFilterBar/FilterBarMobile.tsx +8 -0
- package/src/components/CuponeraFilterBar/ResponsiveCuponeraFilterBar.tsx +18 -0
- package/src/components/CuponeraFilterBar/index.ts +5 -0
- package/src/components/CuponeraFilterBar/types.ts +20 -0
- package/src/components/FilterBar/ServiceFilter.tsx +11 -1
package/dist/KuposUIComponent.js
CHANGED
|
@@ -14,6 +14,7 @@ import ResponsiveServiceItem from "./components/ServiceItem/ResponsiveServiceIte
|
|
|
14
14
|
import { ResponsivePaymentSideBar } from "./components/PaymentSideBar";
|
|
15
15
|
import { ResponsiveServiceList } from "./components/ServiceList";
|
|
16
16
|
import { ResponsiveFilterBar } from "./components/FilterBar";
|
|
17
|
+
import ResponsiveCuponeraFilterBar from "./components/CuponeraFilterBar/ResponsiveCuponeraFilterBar";
|
|
17
18
|
// Using imported ResponsivePaymentSideBar component instead
|
|
18
19
|
export default function KuposUIComponent(props) {
|
|
19
20
|
const { typeOfComponent } = props, restProps = __rest(props, ["typeOfComponent"]);
|
|
@@ -26,6 +27,8 @@ export default function KuposUIComponent(props) {
|
|
|
26
27
|
return (React.createElement(ResponsiveServiceList, Object.assign({}, restProps)));
|
|
27
28
|
case "filterbar":
|
|
28
29
|
return (React.createElement(ResponsiveFilterBar, Object.assign({}, restProps)));
|
|
30
|
+
case "cuponerafilterbar":
|
|
31
|
+
return (React.createElement(ResponsiveCuponeraFilterBar, Object.assign({}, restProps)));
|
|
29
32
|
default:
|
|
30
33
|
return (React.createElement("div", { className: "error-message" },
|
|
31
34
|
"Invalid component type: ",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CuponeraFilterBarProps } from "./types";
|
|
3
|
+
declare const FilterBarDesktop: ({ t, seats, filters, setFilters, expandedFilters, setExpandedFilters, translation, colors, icons, }: CuponeraFilterBarProps) => React.JSX.Element;
|
|
4
|
+
export default FilterBarDesktop;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import commonService from "../../utils/CommonService";
|
|
3
|
+
const FilterBarDesktop = ({ t, seats, filters, setFilters, expandedFilters, setExpandedFilters, translation, colors, icons, }) => {
|
|
4
|
+
const uniqueCouponCounts = [
|
|
5
|
+
...new Set(seats.map((seat) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return ((_a = seat === null || seat === void 0 ? void 0 : seat.coupon_details) === null || _a === void 0 ? void 0 : _a.ticketNumbers)
|
|
8
|
+
? seat.no_of_coupons * 2
|
|
9
|
+
: seat.no_of_coupons;
|
|
10
|
+
})),
|
|
11
|
+
].sort((a, b) => a - b);
|
|
12
|
+
const uniqueOperators = [
|
|
13
|
+
...new Set(seats
|
|
14
|
+
.map((seat) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return ((_a = seat === null || seat === void 0 ? void 0 : seat.coupon_details) === null || _a === void 0 ? void 0 : _a.company) || seat.operator_name;
|
|
17
|
+
})
|
|
18
|
+
.filter(Boolean)),
|
|
19
|
+
];
|
|
20
|
+
const uniqueSeatTypes = [
|
|
21
|
+
...new Set(seats
|
|
22
|
+
.map((seat) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return ((_a = seat === null || seat === void 0 ? void 0 : seat.coupon_details) === null || _a === void 0 ? void 0 : _a.seatType) ||
|
|
25
|
+
((seat === null || seat === void 0 ? void 0 : seat.seat_type_name)
|
|
26
|
+
? commonService.capitalize(seat === null || seat === void 0 ? void 0 : seat.seat_type_name)
|
|
27
|
+
: null);
|
|
28
|
+
})
|
|
29
|
+
.filter(Boolean)),
|
|
30
|
+
];
|
|
31
|
+
const toggleFilterSection = (section) => {
|
|
32
|
+
setExpandedFilters((prev) => (Object.assign(Object.assign({}, prev), { [section]: !prev[section] })));
|
|
33
|
+
};
|
|
34
|
+
const applyFilter = (type, value) => {
|
|
35
|
+
setFilters((prev) => {
|
|
36
|
+
const currentValues = [...prev[type]];
|
|
37
|
+
const valueIndex = currentValues.indexOf(value);
|
|
38
|
+
if (valueIndex !== -1) {
|
|
39
|
+
currentValues.splice(valueIndex, 1);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
currentValues.push(value);
|
|
43
|
+
}
|
|
44
|
+
return Object.assign(Object.assign({}, prev), { [type]: currentValues });
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const removeAllFilters = () => {
|
|
48
|
+
setFilters({
|
|
49
|
+
couponCount: [],
|
|
50
|
+
operator: [],
|
|
51
|
+
seatType: [],
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
const hasActiveFilters = filters.couponCount.length > 0 ||
|
|
55
|
+
filters.operator.length > 0 ||
|
|
56
|
+
filters.seatType.length > 0;
|
|
57
|
+
const renderFilterSection = (title, sectionKey, items, filterType) => {
|
|
58
|
+
if (items.length === 0)
|
|
59
|
+
return null;
|
|
60
|
+
const isOpen = expandedFilters[sectionKey];
|
|
61
|
+
return (React.createElement("div", null,
|
|
62
|
+
React.createElement("div", { onClick: () => toggleFilterSection(sectionKey), className: "bold-text flex items-center justify-between mt-[13px] mb-[5px]" },
|
|
63
|
+
title,
|
|
64
|
+
React.createElement("img", { src: isOpen ? icons === null || icons === void 0 ? void 0 : icons.iconUp : icons === null || icons === void 0 ? void 0 : icons.iconDown, alt: "toggle", className: `w-[auto] h-[9px] transition-all duration-300 cursor-pointer` })),
|
|
65
|
+
React.createElement("div", { className: `transition-all duration-300 ease-in-out ${isOpen
|
|
66
|
+
? "opacity-100 translate-y-0"
|
|
67
|
+
: "max-h-0 opacity-0 -translate-y-1"}` }, isOpen &&
|
|
68
|
+
items.map((item, i) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const isActive = (_a = filters[filterType]) === null || _a === void 0 ? void 0 : _a.includes(item);
|
|
71
|
+
const displayLabel = filterType === "couponCount"
|
|
72
|
+
? `${item} pasajes`
|
|
73
|
+
: typeof item === "string"
|
|
74
|
+
? item.toLowerCase()
|
|
75
|
+
: item;
|
|
76
|
+
return (React.createElement("div", { key: i, onClick: () => applyFilter(filterType, item), style: {
|
|
77
|
+
margin: isActive ? "3px 0" : "0",
|
|
78
|
+
backgroundColor: isActive
|
|
79
|
+
? (colors === null || colors === void 0 ? void 0 : colors.selectedBackgroundColor) || "#ffdede"
|
|
80
|
+
: "",
|
|
81
|
+
padding: "2px 0px",
|
|
82
|
+
paddingLeft: isActive ? "11px" : "",
|
|
83
|
+
marginLeft: isActive ? "-10px" : "",
|
|
84
|
+
color: isActive
|
|
85
|
+
? (colors === null || colors === void 0 ? void 0 : colors.selectedFontColor) || "#ff5c60"
|
|
86
|
+
: (colors === null || colors === void 0 ? void 0 : colors.fontColor) || "",
|
|
87
|
+
transition: "background-color 0.25s ease, padding-left 0.25s ease, margin-left 0.25s ease",
|
|
88
|
+
}, className: `flex items-center h-[24px] rounded-[15px] cursor-pointer pt-[4px] ${isActive ? "bold-text" : ""}` },
|
|
89
|
+
React.createElement("span", { style: { textTransform: "capitalize" } }, displayLabel)));
|
|
90
|
+
}))));
|
|
91
|
+
};
|
|
92
|
+
return (React.createElement("div", { className: "relative" },
|
|
93
|
+
React.createElement("div", { style: {
|
|
94
|
+
overflowY: "scroll",
|
|
95
|
+
scrollbarWidth: "none",
|
|
96
|
+
boxShadow: "none",
|
|
97
|
+
border: "1px solid #ddd",
|
|
98
|
+
zIndex: "9",
|
|
99
|
+
}, className: "p-[16px_20px] relative mb-[20px] max-h-[66vh] rounded-[20px] bg-[#fff]" },
|
|
100
|
+
React.createElement("span", { className: "text-[17.33px] bold-text flex justify-center mt-[20px]" }, translation === null || translation === void 0 ? void 0 : translation.filterHeading),
|
|
101
|
+
React.createElement("div", { className: "text-[13.33px] pb-[10px]" },
|
|
102
|
+
renderFilterSection((t === null || t === void 0 ? void 0 : t("CUPONERA.NUMBER_OF_TICKETS")) || "", "couponCount", uniqueCouponCounts, "couponCount"),
|
|
103
|
+
renderFilterSection((t === null || t === void 0 ? void 0 : t("CUPONERA.COMPANY")) || "", "operator", uniqueOperators, "operator"),
|
|
104
|
+
renderFilterSection((t === null || t === void 0 ? void 0 : t("CUPONERA.SEAT_TYPE")) || "", "seatType", uniqueSeatTypes, "seatType"))),
|
|
105
|
+
React.createElement("div", { onClick: removeAllFilters, className: `group text-[13.33px] bold-text items-center cursor-pointer absolute flex justify-center bg-[#eaeaea] pt-[35px] pb-[7px] w-full left-0 z-[1] -bottom-[30px] rounded-b-[10px] transition-all duration-300 ease-in-out ${hasActiveFilters
|
|
106
|
+
? "translate-y-0 opacity-100"
|
|
107
|
+
: "translate-y-[-10px] opacity-0 pointer-events-none"}` },
|
|
108
|
+
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.crossIcon, alt: "removeFilterIcon", className: "w-[16px] h-[16px] mr-[10px] transition-transform duration-300 group-hover:scale-110" }),
|
|
109
|
+
(translation === null || translation === void 0 ? void 0 : translation.removeFilters) || (t === null || t === void 0 ? void 0 : t("RESULTS_PAGE.REMOVE_FILTERS")))));
|
|
110
|
+
};
|
|
111
|
+
export default FilterBarDesktop;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import FilterBarMobile from "../CuponeraFilterBar/FilterBarMobile";
|
|
3
|
+
import FilterBarDesktop from "../CuponeraFilterBar/FilterBarDesktop";
|
|
4
|
+
export default function ResponsiveCuponeraFilterBar(props) {
|
|
5
|
+
const { variant } = props;
|
|
6
|
+
if (variant === "mobile") {
|
|
7
|
+
return (React.createElement(FilterBarMobile, Object.assign({}, props)));
|
|
8
|
+
}
|
|
9
|
+
return React.createElement(FilterBarDesktop, Object.assign({}, props));
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import FilterBarDesktop from "../CuponeraFilterBar/FilterBarDesktop";
|
|
2
|
+
import FilterBarMobile from "../CuponeraFilterBar/FilterBarMobile";
|
|
3
|
+
import ResponsiveFilterBar from "../CuponeraFilterBar/ResponsiveCuponeraFilterBar";
|
|
4
|
+
export { FilterBarDesktop, FilterBarMobile, ResponsiveFilterBar };
|
|
5
|
+
export type { CuponeraFilterBarProps } from "../CuponeraFilterBar/types";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import FilterBarDesktop from "../CuponeraFilterBar/FilterBarDesktop";
|
|
2
|
+
import FilterBarMobile from "../CuponeraFilterBar/FilterBarMobile";
|
|
3
|
+
import ResponsiveFilterBar from "../CuponeraFilterBar/ResponsiveCuponeraFilterBar";
|
|
4
|
+
export { FilterBarDesktop, FilterBarMobile, ResponsiveFilterBar };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface CuponeraFilterBarProps {
|
|
2
|
+
variant?: "mobile" | "desktop";
|
|
3
|
+
t?: (key: string) => string;
|
|
4
|
+
seats: any;
|
|
5
|
+
filters: any;
|
|
6
|
+
setFilters: any;
|
|
7
|
+
expandedFilters: any;
|
|
8
|
+
setExpandedFilters: any;
|
|
9
|
+
translation?: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
colors: {
|
|
13
|
+
fontColor?: string;
|
|
14
|
+
selectedFontColor?: string;
|
|
15
|
+
selectedBackgroundColor?: string;
|
|
16
|
+
};
|
|
17
|
+
icons?: {
|
|
18
|
+
iconUp?: string;
|
|
19
|
+
iconDown?: string;
|
|
20
|
+
crossIcon?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -240,7 +240,12 @@ class ServiceFilter extends React.Component {
|
|
|
240
240
|
? `text-[${this.props.colors.selectedTextColor}]`
|
|
241
241
|
: ""} ${val.active ? "bold-text" : ""}` },
|
|
242
242
|
val.icon && this.props.icons && (React.createElement("img", { src: iconKey, alt: val.icon, className: "w-[20px] h-[20px] mr-[10px] " })),
|
|
243
|
-
React.createElement("span", {
|
|
243
|
+
React.createElement("span", { style: {
|
|
244
|
+
textTransform: option.type !== "time" ? "capitalize" : "none",
|
|
245
|
+
} }, option.type === "time"
|
|
246
|
+
? label.charAt(0).toUpperCase() +
|
|
247
|
+
label.slice(1).toLowerCase()
|
|
248
|
+
: label.toLowerCase())));
|
|
244
249
|
}))));
|
|
245
250
|
}
|
|
246
251
|
render() {
|
package/package.json
CHANGED
package/src/KuposUIComponent.tsx
CHANGED
|
@@ -6,7 +6,9 @@ import { ResponsiveServiceList } from "./components/ServiceList";
|
|
|
6
6
|
import { PaymentSideBarProps } from "./components/PaymentSideBar/types";
|
|
7
7
|
import { ServiceListProps } from "./components/ServiceList/types";
|
|
8
8
|
import { FilterBarProps } from "./components/FilterBar/tyoes";
|
|
9
|
+
import { CuponeraFilterBarProps } from "./components/CuponeraFilterBar/types";
|
|
9
10
|
import { ResponsiveFilterBar } from "./components/FilterBar";
|
|
11
|
+
import ResponsiveCuponeraFilterBar from "./components/CuponeraFilterBar/ResponsiveCuponeraFilterBar";
|
|
10
12
|
|
|
11
13
|
interface KuposUIComponentProps {
|
|
12
14
|
typeOfComponent:
|
|
@@ -105,7 +107,7 @@ interface KuposUIComponentProps {
|
|
|
105
107
|
// Using imported ResponsivePaymentSideBar component instead
|
|
106
108
|
|
|
107
109
|
export default function KuposUIComponent(
|
|
108
|
-
props: KuposUIComponentProps
|
|
110
|
+
props: KuposUIComponentProps,
|
|
109
111
|
): React.ReactElement {
|
|
110
112
|
const { typeOfComponent, ...restProps } = props;
|
|
111
113
|
|
|
@@ -132,6 +134,13 @@ export default function KuposUIComponent(
|
|
|
132
134
|
<ResponsiveFilterBar {...(restProps as unknown as FilterBarProps)} />
|
|
133
135
|
);
|
|
134
136
|
|
|
137
|
+
case "cuponerafilterbar":
|
|
138
|
+
return (
|
|
139
|
+
<ResponsiveCuponeraFilterBar
|
|
140
|
+
{...(restProps as unknown as CuponeraFilterBarProps)}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
|
|
135
144
|
default:
|
|
136
145
|
return (
|
|
137
146
|
<div className="error-message">
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CuponeraFilterBarProps } from "./types";
|
|
3
|
+
import commonService from "../../utils/CommonService";
|
|
4
|
+
|
|
5
|
+
const FilterBarDesktop = ({
|
|
6
|
+
t,
|
|
7
|
+
seats,
|
|
8
|
+
filters,
|
|
9
|
+
setFilters,
|
|
10
|
+
expandedFilters,
|
|
11
|
+
setExpandedFilters,
|
|
12
|
+
translation,
|
|
13
|
+
colors,
|
|
14
|
+
icons,
|
|
15
|
+
}: CuponeraFilterBarProps) => {
|
|
16
|
+
const uniqueCouponCounts: number[] = (
|
|
17
|
+
[
|
|
18
|
+
...new Set(
|
|
19
|
+
seats.map((seat: any) => {
|
|
20
|
+
return seat?.coupon_details?.ticketNumbers
|
|
21
|
+
? seat.no_of_coupons * 2
|
|
22
|
+
: seat.no_of_coupons;
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
] as number[]
|
|
26
|
+
).sort((a, b) => a - b);
|
|
27
|
+
|
|
28
|
+
const uniqueOperators: string[] = [
|
|
29
|
+
...new Set<string>(
|
|
30
|
+
seats
|
|
31
|
+
.map((seat: any) => {
|
|
32
|
+
return seat?.coupon_details?.company || seat.operator_name;
|
|
33
|
+
})
|
|
34
|
+
.filter(Boolean),
|
|
35
|
+
),
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const uniqueSeatTypes: string[] = [
|
|
39
|
+
...new Set<string>(
|
|
40
|
+
seats
|
|
41
|
+
.map(
|
|
42
|
+
(seat: any) =>
|
|
43
|
+
seat?.coupon_details?.seatType ||
|
|
44
|
+
(seat?.seat_type_name
|
|
45
|
+
? commonService.capitalize(seat?.seat_type_name)
|
|
46
|
+
: null),
|
|
47
|
+
)
|
|
48
|
+
.filter(Boolean),
|
|
49
|
+
),
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const toggleFilterSection = (section: string) => {
|
|
53
|
+
setExpandedFilters((prev: any) => ({
|
|
54
|
+
...prev,
|
|
55
|
+
[section]: !prev[section],
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const applyFilter = (type: string, value: any) => {
|
|
60
|
+
setFilters((prev: any) => {
|
|
61
|
+
const currentValues = [...prev[type]];
|
|
62
|
+
const valueIndex = currentValues.indexOf(value);
|
|
63
|
+
if (valueIndex !== -1) {
|
|
64
|
+
currentValues.splice(valueIndex, 1);
|
|
65
|
+
} else {
|
|
66
|
+
currentValues.push(value);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...prev,
|
|
70
|
+
[type]: currentValues,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const removeAllFilters = () => {
|
|
76
|
+
setFilters({
|
|
77
|
+
couponCount: [],
|
|
78
|
+
operator: [],
|
|
79
|
+
seatType: [],
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const hasActiveFilters =
|
|
84
|
+
filters.couponCount.length > 0 ||
|
|
85
|
+
filters.operator.length > 0 ||
|
|
86
|
+
filters.seatType.length > 0;
|
|
87
|
+
|
|
88
|
+
const renderFilterSection = (
|
|
89
|
+
title: string,
|
|
90
|
+
sectionKey: string,
|
|
91
|
+
items: any[],
|
|
92
|
+
filterType: string,
|
|
93
|
+
) => {
|
|
94
|
+
if (items.length === 0) return null;
|
|
95
|
+
const isOpen = expandedFilters[sectionKey];
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div>
|
|
99
|
+
<div
|
|
100
|
+
onClick={() => toggleFilterSection(sectionKey)}
|
|
101
|
+
className="bold-text flex items-center justify-between mt-[13px] mb-[5px]"
|
|
102
|
+
>
|
|
103
|
+
{title}
|
|
104
|
+
<img
|
|
105
|
+
src={isOpen ? icons?.iconUp : icons?.iconDown}
|
|
106
|
+
alt="toggle"
|
|
107
|
+
className={`w-[auto] h-[9px] transition-all duration-300 cursor-pointer`}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
<div
|
|
111
|
+
className={`transition-all duration-300 ease-in-out ${
|
|
112
|
+
isOpen
|
|
113
|
+
? "opacity-100 translate-y-0"
|
|
114
|
+
: "max-h-0 opacity-0 -translate-y-1"
|
|
115
|
+
}`}
|
|
116
|
+
>
|
|
117
|
+
{isOpen &&
|
|
118
|
+
items.map((item, i) => {
|
|
119
|
+
const isActive = filters[filterType]?.includes(item);
|
|
120
|
+
const displayLabel =
|
|
121
|
+
filterType === "couponCount"
|
|
122
|
+
? `${item} pasajes`
|
|
123
|
+
: typeof item === "string"
|
|
124
|
+
? item.toLowerCase()
|
|
125
|
+
: item;
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div
|
|
129
|
+
key={i}
|
|
130
|
+
onClick={() => applyFilter(filterType, item)}
|
|
131
|
+
style={{
|
|
132
|
+
margin: isActive ? "3px 0" : "0",
|
|
133
|
+
backgroundColor: isActive
|
|
134
|
+
? colors?.selectedBackgroundColor || "#ffdede"
|
|
135
|
+
: "",
|
|
136
|
+
padding: "2px 0px",
|
|
137
|
+
paddingLeft: isActive ? "11px" : "",
|
|
138
|
+
marginLeft: isActive ? "-10px" : "",
|
|
139
|
+
color: isActive
|
|
140
|
+
? colors?.selectedFontColor || "#ff5c60"
|
|
141
|
+
: colors?.fontColor || "",
|
|
142
|
+
transition:
|
|
143
|
+
"background-color 0.25s ease, padding-left 0.25s ease, margin-left 0.25s ease",
|
|
144
|
+
}}
|
|
145
|
+
className={`flex items-center h-[24px] rounded-[15px] cursor-pointer pt-[4px] ${
|
|
146
|
+
isActive ? "bold-text" : ""
|
|
147
|
+
}`}
|
|
148
|
+
>
|
|
149
|
+
<span style={{ textTransform: "capitalize" }}>
|
|
150
|
+
{displayLabel}
|
|
151
|
+
</span>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
})}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<div className="relative">
|
|
162
|
+
<div
|
|
163
|
+
style={{
|
|
164
|
+
overflowY: "scroll",
|
|
165
|
+
scrollbarWidth: "none",
|
|
166
|
+
boxShadow: "none",
|
|
167
|
+
border: "1px solid #ddd",
|
|
168
|
+
zIndex: "9",
|
|
169
|
+
}}
|
|
170
|
+
className="p-[16px_20px] relative mb-[20px] max-h-[66vh] rounded-[20px] bg-[#fff]"
|
|
171
|
+
>
|
|
172
|
+
<span className="text-[17.33px] bold-text flex justify-center mt-[20px]">
|
|
173
|
+
{translation?.filterHeading}
|
|
174
|
+
</span>
|
|
175
|
+
<div className="text-[13.33px] pb-[10px]">
|
|
176
|
+
{renderFilterSection(
|
|
177
|
+
t?.("CUPONERA.NUMBER_OF_TICKETS") || "",
|
|
178
|
+
"couponCount",
|
|
179
|
+
uniqueCouponCounts,
|
|
180
|
+
"couponCount",
|
|
181
|
+
)}
|
|
182
|
+
{renderFilterSection(
|
|
183
|
+
t?.("CUPONERA.COMPANY") || "",
|
|
184
|
+
"operator",
|
|
185
|
+
uniqueOperators,
|
|
186
|
+
"operator",
|
|
187
|
+
)}
|
|
188
|
+
{renderFilterSection(
|
|
189
|
+
t?.("CUPONERA.SEAT_TYPE") || "",
|
|
190
|
+
"seatType",
|
|
191
|
+
uniqueSeatTypes,
|
|
192
|
+
"seatType",
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div
|
|
198
|
+
onClick={removeAllFilters}
|
|
199
|
+
className={`group text-[13.33px] bold-text items-center cursor-pointer absolute flex justify-center bg-[#eaeaea] pt-[35px] pb-[7px] w-full left-0 z-[1] -bottom-[30px] rounded-b-[10px] transition-all duration-300 ease-in-out ${
|
|
200
|
+
hasActiveFilters
|
|
201
|
+
? "translate-y-0 opacity-100"
|
|
202
|
+
: "translate-y-[-10px] opacity-0 pointer-events-none"
|
|
203
|
+
}`}
|
|
204
|
+
>
|
|
205
|
+
<img
|
|
206
|
+
src={icons?.crossIcon}
|
|
207
|
+
alt="removeFilterIcon"
|
|
208
|
+
className="w-[16px] h-[16px] mr-[10px] transition-transform duration-300 group-hover:scale-110"
|
|
209
|
+
/>
|
|
210
|
+
{translation?.removeFilters || t?.("RESULTS_PAGE.REMOVE_FILTERS")}
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export default FilterBarDesktop;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import FilterBarMobile from "../CuponeraFilterBar/FilterBarMobile";
|
|
3
|
+
import FilterBarDesktop from "../CuponeraFilterBar/FilterBarDesktop";
|
|
4
|
+
import { CuponeraFilterBarProps } from "../CuponeraFilterBar/types";
|
|
5
|
+
|
|
6
|
+
export default function ResponsiveCuponeraFilterBar(
|
|
7
|
+
props: CuponeraFilterBarProps,
|
|
8
|
+
) {
|
|
9
|
+
const { variant } = props;
|
|
10
|
+
|
|
11
|
+
if (variant === "mobile") {
|
|
12
|
+
return (
|
|
13
|
+
<FilterBarMobile {...(props as unknown as CuponeraFilterBarProps)} />
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return <FilterBarDesktop {...props} />;
|
|
18
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import FilterBarDesktop from "../CuponeraFilterBar/FilterBarDesktop";
|
|
2
|
+
import FilterBarMobile from "../CuponeraFilterBar/FilterBarMobile";
|
|
3
|
+
import ResponsiveFilterBar from "../CuponeraFilterBar/ResponsiveCuponeraFilterBar";
|
|
4
|
+
export { FilterBarDesktop, FilterBarMobile, ResponsiveFilterBar };
|
|
5
|
+
export type { CuponeraFilterBarProps } from "../CuponeraFilterBar/types";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CuponeraFilterBarProps {
|
|
2
|
+
variant?: "mobile" | "desktop";
|
|
3
|
+
t?: (key: string) => string;
|
|
4
|
+
seats: any;
|
|
5
|
+
filters: any;
|
|
6
|
+
setFilters: any;
|
|
7
|
+
expandedFilters: any;
|
|
8
|
+
setExpandedFilters: any;
|
|
9
|
+
translation?: { [key: string]: string };
|
|
10
|
+
colors: {
|
|
11
|
+
fontColor?: string;
|
|
12
|
+
selectedFontColor?: string;
|
|
13
|
+
selectedBackgroundColor?: string;
|
|
14
|
+
};
|
|
15
|
+
icons?: {
|
|
16
|
+
iconUp?: string;
|
|
17
|
+
iconDown?: string;
|
|
18
|
+
crossIcon?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -337,7 +337,17 @@ class ServiceFilter extends React.Component<
|
|
|
337
337
|
className="w-[20px] h-[20px] mr-[10px] "
|
|
338
338
|
/>
|
|
339
339
|
)}
|
|
340
|
-
<span
|
|
340
|
+
<span
|
|
341
|
+
style={{
|
|
342
|
+
textTransform:
|
|
343
|
+
option.type !== "time" ? "capitalize" : "none",
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
{option.type === "time"
|
|
347
|
+
? label.charAt(0).toUpperCase() +
|
|
348
|
+
label.slice(1).toLowerCase()
|
|
349
|
+
: label.toLowerCase()}
|
|
350
|
+
</span>
|
|
341
351
|
</div>
|
|
342
352
|
);
|
|
343
353
|
})}
|