-
Notifications
You must be signed in to change notification settings - Fork 377
Fix issue where NavItem background color does not update on selected status #5873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
<template> | ||
<div | ||
class="flex items-center gap-2 px-4 py-3 text-sm rounded-md transition-colors cursor-pointer" | ||
:class=" | ||
active | ||
? 'bg-white dark-theme:bg-charcoal-600 text-neutral' | ||
: 'text-neutral hover:bg-gray-100 dark-theme:hover:bg-charcoal-300' | ||
" | ||
role="button" | ||
@click="onClick" | ||
> | ||
<div :class="navItemClasses" role="button" @click="onClick"> | ||
<NavIcon v-if="icon" :icon="icon" /> | ||
<i-lucide:folder v-else class="text-xs text-neutral" /> | ||
<span class="flex items-center"> | ||
|
@@ -18,7 +9,10 @@ | |
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
|
||
import type { NavItemData } from '@/types/navTypes' | ||
import { cn } from '@/utils/tailwindUtil' | ||
|
||
import NavIcon from './NavIcon.vue' | ||
|
||
|
@@ -27,4 +21,14 @@ const { icon, active, onClick } = defineProps<{ | |
active?: boolean | ||
onClick: () => void | ||
}>() | ||
|
||
const navItemClasses = computed(() => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [architecture] low Priority Issue: Positive refactor following project conventions |
||
cn( | ||
'flex items-center gap-2 px-4 py-3 text-sm rounded-md transition-colors cursor-pointer text-neutral', | ||
{ | ||
'bg-gray-100 dark-theme:bg-charcoal-300': active, | ||
viva-jinyi marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It feels a little weird to me to have |
||
'hover:bg-gray-100 dark-theme:hover:bg-charcoal-300': !active | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [quality] medium Priority Issue: Hover state logic inconsistency |
||
} | ||
) | ||
) | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[quality] low Priority
Issue: Potentially unused import
Context: The NavItemData import is only used for typing the icon prop. Consider if this import is necessary or if the type can be simplified.
Suggestion: Review if 'NavItemData["icon"]' type annotation is the most appropriate way to type the icon prop, or if a more direct type like 'string' would be clearer.