Skip to content

Commit

Permalink
fix(ButtonPrimitive): width prop now works as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Dec 18, 2023
1 parent 3863e45 commit 8911e40
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const ButtonPrimitive = React.forwardRef<HTMLButtonElement | HTMLAnchorElement,
iconRight,
// Container vars
height,
width,
padding,
contentAlign = "center",
fontWeight,
Expand Down Expand Up @@ -116,6 +117,7 @@ const ButtonPrimitive = React.forwardRef<HTMLButtonElement | HTMLAnchorElement,

const varsButton = {
"--button-height": height,
"--button-width": width,
"--button-padding": padding,
"--button-content-align": contentAlign,
"--button-font-weight": fontWeight,
Expand Down Expand Up @@ -159,11 +161,8 @@ const ButtonPrimitive = React.forwardRef<HTMLButtonElement | HTMLAnchorElement,
disabled={isDisabled}
className={cx(
className,
"orbit-button-primitive font-base duration-fast group relative max-w-full items-center border-none text-center leading-none transition-all [&>*]:align-middle [&_.orbit-loading-spinner]:stroke-[currentColor]",
"orbit-button-primitive font-base duration-fast group relative max-w-full items-center justify-center border-none text-center leading-none transition-all [&>*]:align-middle [&_.orbit-loading-spinner]:stroke-[currentColor]",
fullWidth && "w-full",
centered || children == null
? "justify-center"
: "[justify-content:var(--button-content-align)]",
circled !== true && "rounded-large tb:rounded-normal",
isDisabled
? "cursor-not-allowed opacity-30"
Expand All @@ -178,6 +177,7 @@ const ButtonPrimitive = React.forwardRef<HTMLButtonElement | HTMLAnchorElement,
varsButton["--button-icon-width"] != null &&
"[&_.orbit-loading-spinner]:w-[var(--button-icon-width)]",
// button vars
varsButton["--button-width"] != null && "w-[var(--button-width)]",
varsButton["--button-height"] != null && "h-[var(--button-height)]",
varsButton["--button-height"] != null &&
circled === true &&
Expand Down Expand Up @@ -254,7 +254,7 @@ const ButtonPrimitive = React.forwardRef<HTMLButtonElement | HTMLAnchorElement,
{children != null && (
<div
className={cx(
"orbit-button-primitive-content inline-block",
"orbit-button-primitive-content inline-block [justify-content:var(--button-content-align)]",
(iconLeft != null || iconRight != null) && "text-start",
loading === true && "invisible",
centered !== true && "flex-1",
Expand Down

0 comments on commit 8911e40

Please sign in to comment.