From aabbfca7633d5b839d18cf9f96d31a43ec52fc40 Mon Sep 17 00:00:00 2001 From: Dark_Phoenix_ <92178883+0DarkPhoenix@users.noreply.github.com> Date: Fri, 18 Jul 2025 21:24:16 +0200 Subject: [PATCH] Additions for responsive sidebar pull request (#131) * - Made the sidebar responsive - Edited the hero-gradient svg to fix an issue where it would never scale to the full width of the sidebar - Fixed a bug on Chrome where you'd need to click twice on a category element in the sidebar to see its tools * - Added hover effect for category button - Disabled transition built into the n-menu element to display the hover effect for tools items directly instead of after a slight delay * - Added a tooltip which shows when the title of the tool is truncated * - Increased sidebar width from 10% to 12.5% - Changed check truncation calculation for container width to a more accurate variant to fix a bug where a tooltip was shown without the text being truncated * fixed merge conflicts * Fixed merge conflict in pnpm lock file * Another fix for merge conflixt pnpm lock file --------- Co-authored-by: sharevb --- src/components/MenuItemTooltip.vue | 6 +++++- src/components/MenuLayout.vue | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/MenuItemTooltip.vue b/src/components/MenuItemTooltip.vue index 363ac33d..9b5780d7 100644 --- a/src/components/MenuItemTooltip.vue +++ b/src/components/MenuItemTooltip.vue @@ -23,7 +23,11 @@ async function checkTruncation() { context.font = `${computedStyle.fontWeight} ${computedStyle.fontSize} ${computedStyle.fontFamily}`; const textWidth = context.measureText(text).width; - const containerWidth = textRef.value.clientWidth; + + // Calculate precise container width by accounting for padding + const containerWidth = textRef.value.clientWidth + - Number.parseFloat(computedStyle.paddingLeft) + - Number.parseFloat(computedStyle.paddingRight); showTooltip.value = textWidth > containerWidth; } diff --git a/src/components/MenuLayout.vue b/src/components/MenuLayout.vue index 6c0d1d17..56cd5db0 100644 --- a/src/components/MenuLayout.vue +++ b/src/components/MenuLayout.vue @@ -29,8 +29,8 @@ const siderWidth = computed(() => { return 0; } - // Get 10% of window width, but ensure it's at least 240px - const tenPercent = windowWidth.value * 0.1; + // Use 12.5% of window width, but ensure it's at least 240px + const tenPercent = windowWidth.value * 0.125; return Math.max(240, tenPercent); });