foundry-component-library 0.2.27 → 0.2.28
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.
|
@@ -34,17 +34,23 @@ const Dropdown = ({
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
if (!items) return;
|
|
37
|
-
|
|
37
|
+
let currentDisplay = heading;
|
|
38
|
+
|
|
39
|
+
if (displayLabels && selected.category === heading.toLowerCase()) {
|
|
40
|
+
currentDisplay = displayLabels[selected.tag];
|
|
41
|
+
} else if (selected.category === heading.toLowerCase()) {
|
|
42
|
+
currentDisplay = selected.tag;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log("pp", displayLabels);
|
|
38
46
|
|
|
39
47
|
return (
|
|
40
48
|
<div
|
|
41
49
|
className={`${styles.dropdown} ${isOpen ? styles.active : ""}`}
|
|
42
|
-
ref={ref}
|
|
43
|
-
>
|
|
50
|
+
ref={ref}>
|
|
44
51
|
<button
|
|
45
52
|
onClick={toggleOpen}
|
|
46
|
-
className={`${styles.dropdownHeading} ${isOpen ? styles.active : ""}`}
|
|
47
|
-
>
|
|
53
|
+
className={`${styles.dropdownHeading} ${isOpen ? styles.active : ""}`}>
|
|
48
54
|
<span>{currentDisplay}</span>
|
|
49
55
|
<CaretDown />
|
|
50
56
|
</button>
|
|
@@ -56,25 +62,23 @@ const Dropdown = ({
|
|
|
56
62
|
animate={{ opacity: 1, y: 0 }}
|
|
57
63
|
exit={{ opacity: 0, y: -5 }}
|
|
58
64
|
transition={{ duration: 0.2 }}
|
|
59
|
-
className={styles.dropdownInner}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}`}
|
|
74
|
-
>
|
|
65
|
+
className={styles.dropdownInner}>
|
|
66
|
+
{items.map((option) => (
|
|
67
|
+
<motion.li
|
|
68
|
+
key={option}
|
|
69
|
+
onClick={() => {
|
|
70
|
+
setSelected({
|
|
71
|
+
category: heading.toLocaleLowerCase(),
|
|
72
|
+
tag: option,
|
|
73
|
+
});
|
|
74
|
+
setIsOpen(false);
|
|
75
|
+
}}
|
|
76
|
+
className={`${styles.option} ${
|
|
77
|
+
selected.tag === option ? styles.active : ""
|
|
78
|
+
}`}>
|
|
75
79
|
{displayLabels?.[option] ?? option}
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
</motion.li>
|
|
81
|
+
))}
|
|
78
82
|
</motion.ul>
|
|
79
83
|
)}
|
|
80
84
|
</AnimatePresence>
|
|
@@ -78,7 +78,20 @@ const Dropdown = ({
|
|
|
78
78
|
<button
|
|
79
79
|
onClick={toggleOpen}
|
|
80
80
|
className={`${styles.dropdownHeading} ${isOpen ? styles.active : ""}`}>
|
|
81
|
-
|
|
81
|
+
{heading === "Industry" && (
|
|
82
|
+
<span>
|
|
83
|
+
{items.includes(selected.tag)
|
|
84
|
+
? industriesDisplayLabels[selected.tag]
|
|
85
|
+
: heading}
|
|
86
|
+
</span>
|
|
87
|
+
)}
|
|
88
|
+
{heading === "Service" && (
|
|
89
|
+
<span>
|
|
90
|
+
{items.includes(selected.tag)
|
|
91
|
+
? servicesDisplayLabels[selected.tag]
|
|
92
|
+
: heading}
|
|
93
|
+
</span>
|
|
94
|
+
)}
|
|
82
95
|
<CaretDown />
|
|
83
96
|
</button>
|
|
84
97
|
|
|
@@ -104,11 +117,10 @@ const Dropdown = ({
|
|
|
104
117
|
className={`${styles.option} ${
|
|
105
118
|
selected.tag === option ? styles.active : ""
|
|
106
119
|
}`}>
|
|
107
|
-
{displayLabels?.[option] ??
|
|
108
|
-
heading === "Industry"
|
|
120
|
+
{displayLabels?.[option] ??
|
|
121
|
+
(heading === "Industry"
|
|
109
122
|
? industriesDisplayLabels[option]
|
|
110
|
-
: servicesDisplayLabels[option]
|
|
111
|
-
)}
|
|
123
|
+
: servicesDisplayLabels[option])}
|
|
112
124
|
</motion.li>
|
|
113
125
|
))}
|
|
114
126
|
</motion.ul>
|