Skip to content

Commit

Permalink
changes in the minimize button in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciphrox committed Feb 15, 2025
1 parent aeee98e commit 4fbfb6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/assets/styles/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
}

.menu-button:is(:active, :hover, :focus-visible) {
background: color-mix(in srgb, var(--primary) 30%, transparent) !important;
--active: 1;
}

Expand Down
5 changes: 4 additions & 1 deletion src/layouts/common/Menu.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import { NavbarLinks } from "@/utils/constants";
</button>
<Navigation pages={NavbarLinks} />
<div class="actions">
<button class="menu-button minimize-toggle" aria-label="Toggle menu size">
<button class="menu-button minimize-toggle" aria-label="Toggle menu size" title="Close sidebar">
<ArrowIcon
width={24}
height={24}
style={{
transform: "rotate(-135deg)"
}}
title="Toggle sidebar"
/>
</button>
<button class="menu-button theme-toggle">
Expand Down Expand Up @@ -106,8 +107,10 @@ import { NavbarLinks } from "@/utils/constants";

const toggleMinimize = () => {
const nav = document.querySelector("#nav");
const minimizeBtn = document.querySelector(".minimize-toggle") as HTMLButtonElement;
nav?.classList.toggle("minimized");
minimizeBtn?.classList.toggle("rotated");
minimizeBtn.title = nav?.classList.contains("minimized") ? "Open sidebar" : "Close sidebar";
};

minimizeBtn?.addEventListener("click", toggleMinimize);
Expand Down

0 comments on commit 4fbfb6a

Please sign in to comment.