-
Notifications
You must be signed in to change notification settings - Fork 114
fix(button): Update button styles to align with Figma #53
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
Closed
CiscoFran10
wants to merge
1
commit into
cloudflare:main
from
CiscoFran10:fix/button-variants-styles
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@cloudflare/kumo": patch | ||
| --- | ||
|
|
||
| Update Button styles to align with Figma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import React from "react"; | ||
| import { ArrowsClockwise, type Icon } from "@phosphor-icons/react"; | ||
| import { ArrowsClockwiseIcon, type Icon } from "@phosphor-icons/react"; | ||
| import { Loader } from "../loader/loader"; | ||
| import { cn } from "../../utils/cn"; | ||
| import { useLinkComponent } from "../../utils/link-provider"; | ||
|
|
@@ -21,55 +21,58 @@ export const KUMO_BUTTON_VARIANTS = { | |
| }, | ||
| size: { | ||
| xs: { | ||
| classes: "h-5 gap-1 rounded-sm px-1.5 text-xs", | ||
| classes: "h-5 gap-1 px-1.5 rounded-sm text-xs", | ||
| description: "Extra small button for compact UIs", | ||
| }, | ||
| sm: { | ||
| classes: "h-6.5 gap-1 rounded-md px-2 text-xs", | ||
| classes: "h-6.5 gap-1 px-2 rounded-md text-xs", | ||
| description: "Small button for secondary actions", | ||
| }, | ||
| base: { | ||
| classes: "h-9 gap-1.5 rounded-lg px-3 text-base", | ||
| classes: "h-9 gap-1.5 px-3 rounded-lg text-base", | ||
| description: "Default button size", | ||
| }, | ||
| lg: { | ||
| classes: "h-10 gap-2 rounded-lg px-4 text-base", | ||
| classes: "h-10 gap-2 px-4 rounded-lg text-base", | ||
| description: "Large button for primary CTAs", | ||
| }, | ||
| }, | ||
| compactSize: { | ||
| xs: { classes: "size-3.5" }, | ||
| sm: { classes: "size-6.5" }, | ||
| base: { classes: "size-9" }, | ||
| lg: { classes: "size-10" }, | ||
| xs: { classes: "size-3.5 [&_svg:not([class*='size-'])]:size-3" }, | ||
| sm: { classes: "size-6.5 [&_svg:not([class*='size-'])]:size-4" }, | ||
| base: { classes: "size-9 [&_svg:not([class*='size-'])]:size-5" }, | ||
| lg: { classes: "size-10 [&_svg:not([class*='size-'])]:size-5" }, | ||
| }, | ||
| variant: { | ||
| primary: { | ||
| classes: | ||
| "bg-kumo-brand !text-white hover:bg-kumo-brand-hover focus:bg-kumo-brand-hover disabled:bg-kumo-brand/50", | ||
| "bg-kumo-brand text-white not-disabled:[:hover,:focus-visible,[data-pressed]]:bg-kumo-brand-hover", | ||
| description: "High-emphasis button for primary actions", | ||
| }, | ||
| secondary: { | ||
| classes: | ||
| "bg-kumo-control !text-kumo-default ring not-disabled:hover:border-secondary! not-disabled:hover:bg-kumo-control disabled:bg-kumo-control/50 disabled:!text-kumo-default/70 ring-kumo-line data-[state=open]:bg-kumo-control", | ||
| "bg-kumo-control text-kumo-default ring ring-kumo-line shadow-none not-disabled:not-data-pressed:hover:ring-kumo-control", | ||
| description: "Default button style for most actions", | ||
| }, | ||
| ghost: { | ||
| classes: "text-kumo-default hover:bg-kumo-tint shadow-none bg-inherit", | ||
| classes: | ||
| "bg-inherit text-kumo-default shadow-none not-disabled:[:hover,[data-pressed]]:bg-kumo-tint", | ||
| description: "Minimal button with no background", | ||
| }, | ||
| destructive: { | ||
| classes: "bg-kumo-danger !text-white hover:bg-kumo-danger/70", | ||
| classes: | ||
| "bg-kumo-danger text-white shadow-none not-disabled:[:hover,[data-pressed]]:bg-kumo-danger/70", | ||
| description: "Danger button for destructive actions like delete", | ||
| }, | ||
| "secondary-destructive": { | ||
| classes: | ||
| "bg-kumo-control !text-kumo-danger ring not-disabled:hover:border-secondary! not-disabled:hover:bg-kumo-control disabled:bg-kumo-control/50 disabled:!text-kumo-danger/70 ring-kumo-line data-[state=open]:bg-kumo-control", | ||
| "bg-kumo-control text-kumo-danger ring ring-kumo-line shadow-none not-disabled:not-data-pressed:hover:ring-kumo-control", | ||
| description: | ||
| "Secondary button with destructive text for less prominent dangerous actions", | ||
| }, | ||
| outline: { | ||
| classes: "bg-kumo-base text-kumo-default ring ring-kumo-line", | ||
| classes: | ||
| "bg-kumo-base text-kumo-default ring ring-kumo-line not-disabled:[:hover,[data-pressed]]:bg-kumo-control data-[state=open]:bg-kumo-control", | ||
| description: "Bordered button with transparent background", | ||
| }, | ||
| }, | ||
|
|
@@ -101,11 +104,11 @@ export function buttonVariants({ | |
|
|
||
| return cn( | ||
| // Base styles | ||
| "group flex w-max shrink-0 items-center font-medium select-none", | ||
| "group flex w-max shrink-0 items-center font-medium select-none [&_svg]:shrink-0 [&_svg]:-mx-0.5", | ||
|
Contributor
Author
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.
Minor optical alignment adjustment for SVG icons next to text. |
||
| "border-0 shadow-xs", | ||
| "cursor-pointer", | ||
| // Disabled state | ||
| "disabled:cursor-not-allowed disabled:text-kumo-subtle", | ||
| "disabled:cursor-not-allowed", | ||
| // Apply variant, size, shape styles from KUMO_BUTTON_VARIANTS | ||
| KUMO_BUTTON_VARIANTS.variant[variant].classes, | ||
| KUMO_BUTTON_VARIANTS.size[size].classes, | ||
|
|
@@ -160,7 +163,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( | |
| ref={ref} | ||
| className={cn( | ||
| buttonVariants({ variant, size, shape }), | ||
| "outline-none focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-ring *:in-focus:opacity-100", // Focus styles | ||
| "outline-none focus:opacity-100 focus-visible:ring-2 focus-visible:ring-kumo-brand *:in-focus:opacity-100", // Focus styles | ||
| disabled && "cursor-not-allowed opacity-50", | ||
| className, | ||
| )} | ||
|
|
@@ -185,7 +188,7 @@ export const RefreshButton = ({ | |
| ...props | ||
| }: ButtonProps) => ( | ||
| <Button shape="square" aria-label={ariaLabel} {...props}> | ||
| <ArrowsClockwise | ||
| <ArrowsClockwiseIcon | ||
| className={cn({ | ||
| "animate-refresh": loading, | ||
| "size-4.5": props.size === "base" || !props.size, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In light mode, the
kumo-controlandkumo-basecolors are identical, which makes the hover state visually indistinguishable. This likely needs an update to the light-mode Figma styles. Waiting for maintainer guidance before proceeding.