Skip to content

Commit eaa0d9f

Browse files
jankeromnesroboquat
authored andcommitted
[dashboard] Support optionally rendering DropDowns with link colors
1 parent be1849e commit eaa0d9f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

components/dashboard/src/components/Arrow.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
function Arrow(props: { up: boolean }) {
7+
function Arrow(props: { up: boolean; customBorderClasses?: string }) {
88
return (
99
<span
10-
className="mx-2 border-gray-400 dark:border-gray-600 group-hover:border-gray-600 dark:group-hover:border-gray-400"
10+
className={
11+
"mx-2 " +
12+
(props.customBorderClasses ||
13+
"border-gray-400 dark:border-gray-600 group-hover:border-gray-600 dark:group-hover:border-gray-400")
14+
}
1115
style={{
1216
marginTop: 2,
1317
marginBottom: 2,

components/dashboard/src/components/DropDown.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ContextMenu from "./ContextMenu";
1111
export interface DropDownProps {
1212
prefix?: string;
1313
customClasses?: string;
14+
renderAsLink?: boolean;
1415
activeEntry?: string;
1516
entries: DropDownEntry[];
1617
}
@@ -35,14 +36,20 @@ function DropDown(props: DropDownProps) {
3536
},
3637
};
3738
});
38-
const font =
39-
"text-gray-400 dark:text-gray-500 text-sm leading-1 group hover:text-gray-600 dark:hover:text-gray-400 transition ease-in-out";
39+
const defaultFont = "text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 ";
40+
const asLinkFont = "text-blue-500 dark:text-blue-400 hover:text-blue-600 dark:hover:text-blue-500";
41+
const asLinkArrowBorder =
42+
"border-blue-500 dark:border-blue-400 group-hover:border-blue-600 dark:group-hover:border-blue-500";
4043
return (
4144
<ContextMenu menuEntries={enhancedEntries} customClasses={`${props.customClasses} right-0`}>
42-
<span className={`py-2 cursor-pointer ${font}`}>
45+
<span
46+
className={`py-2 cursor-pointer text-sm leading-1 group ${
47+
props.renderAsLink ? asLinkFont : defaultFont
48+
} transition ease-in-out`}
49+
>
4350
{props.prefix}
4451
{current}
45-
<Arrow up={false} />
52+
<Arrow up={false} customBorderClasses={props.renderAsLink ? asLinkArrowBorder : undefined} />
4653
</span>
4754
</ContextMenu>
4855
);

0 commit comments

Comments
 (0)