Skip to content
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

feat(DropdownMenu/ContextMenu): handle color field in items #2510

Merged
merged 14 commits into from
Nov 5, 2024

Conversation

hywax
Copy link
Collaborator

@hywax hywax commented Oct 31, 2024

πŸ”— Linked issue

Resolves #2339

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac
Copy link
Member

Let me know if you need help for the styles 😊

Copy link

pkg-pr-new bot commented Nov 1, 2024

pnpm add https://pkg.pr.new/@nuxt/ui@2510

commit: ac6161f

@hywax
Copy link
Collaborator Author

hywax commented Nov 1, 2024

@benjamincanac thanks for the offer of help! But I was able to figure out the styles myself.

Base Hover

neutral - item without styles, repeats current behavior

@hywax hywax marked this pull request as ready for review November 1, 2024 09:04
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing job! I would put the default styles inside the neutral color to avoid unnecessary merging.

@hywax
Copy link
Collaborator Author

hywax commented Nov 1, 2024

Amazing job! I would put the default styles inside the neutral color to avoid unnecessary merging.

I tried it this way, but if specify

defaultVariants: {
  size: 'md',
+  color: 'neutral'
}

Then it will not be applied since defaultVariants applies to props, not internal structures.

We will have to specify fallback wherever we specify color

on top component:
const itemColorDefault = ref(theme.defaultVariants.color)

apply classes:
{ color: item?.color ?? itemColorDefault } <- there are 8 such places in one component

@benjamincanac benjamincanac changed the title feat(DropdownMenu/ContextMenu): handle color prop feat(DropdownMenu/ContextMenu): handle color field in items Nov 1, 2024
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add in the tests a color on one of the items? πŸ™‚

@hywax
Copy link
Collaborator Author

hywax commented Nov 1, 2024

Done πŸ™‚

@benjamincanac benjamincanac merged commit f66c96e into nuxt:v3 Nov 5, 2024
2 checks passed
@benjamincanac
Copy link
Member

Thanks @hywax! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants