forked from github/plane
style: new primary button design
This commit is contained in:
parent
99cf2d4e8d
commit
c5d7d4f751
1
apps/app/components/ui/button/index.ts
Normal file
1
apps/app/components/ui/button/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./primary-button";
|
32
apps/app/components/ui/button/primary-button.tsx
Normal file
32
apps/app/components/ui/button/primary-button.tsx
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
type TButtonProps = {
|
||||||
|
children: React.ReactNode;
|
||||||
|
className?: string;
|
||||||
|
onClick?: () => void;
|
||||||
|
type?: "button" | "submit" | "reset";
|
||||||
|
disabled?: boolean;
|
||||||
|
loading?: boolean;
|
||||||
|
size?: "sm" | "md" | "lg";
|
||||||
|
};
|
||||||
|
|
||||||
|
export const PrimaryButton: React.FC<TButtonProps> = (props) => {
|
||||||
|
const { children, className, onClick, type, disabled, loading, size = "md" } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type={type}
|
||||||
|
className={`hover:bg-opacity-90 transition-colors text-white rounded-lg ${
|
||||||
|
size === "sm"
|
||||||
|
? "px-2.5 py-1.5 text-sm"
|
||||||
|
: size === "md"
|
||||||
|
? "px-3 py-2 text-base"
|
||||||
|
: "px-4 py-3 text-lg"
|
||||||
|
} ${disabled ? "bg-gray-400 cursor-not-allowed" : "bg-theme"} ${className || ""} ${
|
||||||
|
loading ? "cursor-wait" : ""
|
||||||
|
}`}
|
||||||
|
onClick={onClick}
|
||||||
|
disabled={disabled || loading}
|
||||||
|
>
|
||||||
|
<div className="flex items-center">{children}</div>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user