Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 21, 2023
1 parent 5ba127d commit bb70d37
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ButtonStory.argTypes = {
labels: {
primary: "Primary",
secondary: "Secondary",
}
},
},
defaultValue: "primary",
}
},
};
42 changes: 24 additions & 18 deletions src/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
import { cn } from "@/utils/merge.js";
import {cva, VariantProps} from "class-variance-authority";
import { cva, VariantProps } from "class-variance-authority";

export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonStyle> {
export interface ButtonProps
extends React.HTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonStyle> {
disabled?: boolean;
}

const buttonStyle = cva("bg-primary text-white py-3 px-6 rounded leading-[1.15]", {
variants: {
intent: {
primary: "bg-primary text-white",
secondary: "bg-secondary text-white",
const buttonStyle = cva(
"bg-primary text-white py-3 px-6 rounded leading-[1.15]",
{
variants: {
intent: {
primary: "bg-primary text-white",
secondary: "bg-secondary text-white",
},
disabled: {
true: "opacity-50 cursor-not-allowed",
false: "",
},
},
disabled: {
true: "opacity-50 cursor-not-allowed",
false: "",
}
}
})
},
);

export const Button = (props: ButtonProps) => {
const { className, intent, ...rest } = props;

return (
<button
className={cn(buttonStyle({
disabled: props.disabled,
intent: intent,
className: className,
}),
className={cn(
buttonStyle({
disabled: props.disabled,
intent: intent,
className: className,
}),
className,
)}
{...rest}
Expand Down

0 comments on commit bb70d37

Please sign in to comment.