Skip to content

Commit

Permalink
fix: wrong logo file when on "dark" appearance setting (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
diogogmatos authored Nov 19, 2024
1 parent fe18ee0 commit b9a799c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ const Layout = ({
}: ILayoutProps) => {
const [isOpen, setIsOpen] = useState(false);
const hamburgerLine = `h-1 w-6 my-0.5 rounded-full bg-black transition ease transform duration-300 dark:bg-neutral-200 bg-neutral-900`;
const [image, setImage] = useState<string>("");
const { resolvedTheme } = useTheme();

useEffect(() => {
setImage(
resolvedTheme === "dark"
? "/calendarium-dark.svg"
: "/calendarium-light.svg"
);
}, [resolvedTheme]);

return (
<div className="text-neutral-900 dark:text-neutral-200 lg:flex">
<Head>
Expand Down Expand Up @@ -81,11 +90,7 @@ const Layout = ({
className="h-9 w-auto min-[400px]:h-10 sm:h-12"
width={0}
height={0}
src={
resolvedTheme === "dark"
? "/calendarium-dark.svg"
: "/calendarium-light.svg"
}
src={image}
alt="Calendarium Logo"
/>
</Link>
Expand Down
15 changes: 10 additions & 5 deletions components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const Sidebar = ({
const [checked, setChecked] = useState<number[] | SelectedShift[]>([]);
const [promptInstall, setPromptInstall] =
useState<BeforeInstallPromptEvent>(null);
const [image, setImage] = useState<string>("");

function clearSelection() {
setClear(true);
Expand All @@ -59,6 +60,14 @@ const Sidebar = ({

const { resolvedTheme } = useTheme();

useEffect(() => {
setImage(
resolvedTheme === "dark"
? "/calendarium-dark.svg"
: "/calendarium-light.svg"
);
}, [resolvedTheme]);

return (
<nav
className={`${sidebar} ${isOpen ? "block" : "-translate-x-full"}`}
Expand All @@ -75,11 +84,7 @@ const Sidebar = ({
className="h-[46px] w-auto"
width={0}
height={0}
src={
resolvedTheme === "dark"
? "/calendarium-dark.svg"
: "/calendarium-light.svg"
}
src={image}
alt="Calendarium Logo"
/>
</Link>
Expand Down

0 comments on commit b9a799c

Please sign in to comment.