Skip to content

Commit

Permalink
fix(ToolMenuLinkButton): support dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 2, 2024
1 parent 7be61a9 commit fe92f57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion studio/components/toolMenuLinkButton/ToolMenuLinkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styles from "./toolMenuLinkButton.module.css";
import { useTheme } from "@sanity/ui";

interface LinkButtonProps {
label: string;
Expand All @@ -11,9 +12,11 @@ export const ToolMenuLinkButton = ({
value,
context,
}: LinkButtonProps) => {
const theme = useTheme();
const prefersDark = theme.sanity.v2?.color._dark ?? false;
return (
<a
className={`${styles.wrapper}${context === "sidebar" ? ` ${styles.inSidebar}` : ""}`}
className={`${styles.wrapper}${context === "sidebar" ? ` ${styles.inSidebar}` : ""}${prefersDark ? ` ${styles.darkTheme}` : ""}`}
href={value}
>
<span className={styles.text}>{label}</span>
Expand Down
12 changes: 12 additions & 0 deletions studio/components/toolMenuLinkButton/toolMenuLinkButton.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
background: #f5f5f7;
}

.darkTheme.wrapper:hover {
background: #191a24;
}

.text {
display: flex;
align-items: center;
Expand All @@ -36,3 +40,11 @@
background-color: #323545;
}
}

.darkTheme .text {
color: #bec0cd;

&::after {
background-color: #bec0cd;
}
}

0 comments on commit fe92f57

Please sign in to comment.