-
Notifications
You must be signed in to change notification settings - Fork 4
fix(callout-banner): tone-preserving hover on clickable banners #12
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
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 |
|---|---|---|
|
|
@@ -10,6 +10,9 @@ | |
| <component | ||
| :is="clickable ? 'button' : 'div'" | ||
| :type="clickable ? 'button' : undefined" | ||
| data-slot="callout-banner" | ||
| :data-tone="tone" | ||
| :data-clickable="clickable ? '' : undefined" | ||
| class="flex flex-col gap-3 rounded-menu-shell border px-4 py-3 text-left sm:flex-row sm:items-center" | ||
| :class="[toneClass, clickable ? interactiveClass : '']" | ||
| > | ||
|
|
@@ -68,19 +71,27 @@ const props = withDefaults(defineProps<{ | |
| }) | ||
|
|
||
| // Full literal class strings per tone — Tailwind scans source text, so a runtime | ||
| // concat would never be generated. Both tones now use a soft-token triplet. | ||
| const toneClass = computed(() => | ||
| props.tone === 'destructive' | ||
| ? 'border-destructive-border bg-destructive-soft' | ||
| : 'border-warning-border bg-warning-soft', | ||
| ) | ||
| // concat would never be generated. Clickable hover uses the *-soft-hover tokens | ||
| // (utilities layer) so the wash is visible and stays in the same tone family. | ||
| const toneClass = computed(() => { | ||
| if (props.tone === 'destructive') { | ||
| const rest = 'border-destructive-border bg-destructive-soft' | ||
| return props.clickable | ||
| ? `${rest} transition-colors hover:bg-destructive-soft-hover hover:border-destructive-border-hover` | ||
|
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.
On every clickable-banner hover, this now deepens both the background and the border, stacking two simultaneous chrome changes where the design contract permits one layer to change in place. Preserve the tone by deepening only the soft fill and remove the AGENTS.md reference: AGENTS.md:L142-L151 Useful? React with 👍 / 👎. |
||
| : rest | ||
| } | ||
| const rest = 'border-warning-border bg-warning-soft' | ||
| return props.clickable | ||
| ? `${rest} transition-colors hover:bg-warning-soft-hover hover:border-warning-border-hover` | ||
| : rest | ||
| }) | ||
|
|
||
| const iconClass = computed(() => | ||
| props.tone === 'destructive' ? 'text-destructive' : 'text-warning-foreground', | ||
| ) | ||
|
|
||
| // When the whole banner is the affordance, it gets the neutral overlay hover the | ||
| // rest of the app's clickable surfaces use — the tile's own chrome, not a page | ||
| // injection. | ||
| const interactiveClass = 'w-full transition-colors hover:bg-accent' /* ui-allow-style */ | ||
| // When the whole banner is the affordance, hover stays in the same tone family | ||
| // (see [data-slot="callout-banner"] rules in style.css) — not hover:bg-accent, | ||
| // which replaced destructive/warning fills with neutral gray. | ||
| const interactiveClass = 'w-full cursor-pointer' | ||
| </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.
For every clickable banner, these
hover:*andtransition-colorsutilities put interaction chrome in the Vue utility layer, leaving the newdata-slot/data-toneattributes unused and preventing this state from being maintained through the library's central chrome contract. Move the tone-specific hover and transition rules intostyle.css, keyed by the added data attributes, rather than resolving the cascade conflict by bypassing the required ownership boundary.AGENTS.md reference: AGENTS.md:L112-L114
Useful? React with 👍 / 👎.