plane/apps/app/components/ui/outline-button.tsx
Aaryan Khandelwal 3c2f5d12ed
feat: themes (#902)
* chore: add next theme and initial setup

* chore: add dark mode colors to layouts

* chore: user general setting page theming

* chore: dashboard theming

* chore: project page theming

* chore: workspace setting page theming

* chore: my issue page theming

* chore: cmdk theming

* chore: change hardcode bg and text color to theme

* chore: change color name according to the design

* style: fix card in the dashboard

* style: fix merge conflict design issues

* style: add light high contrast and dark high contrast

* style: fix cmd k menu color and selection

* feat: change theme from cmdk menu

* chore: add multiple theme field to custom theme

* chore: removed custom theming

* fix: build error

---------

Co-authored-by: Saheb Giri <iamsahebgiri@gmail.com>
2023-04-20 13:41:24 +05:30

61 lines
1.7 KiB
TypeScript

import React from "react";
type Props = {
onClick?: () => void;
children: React.ReactNode;
type?: "button" | "submit" | "reset";
className?: string;
theme?: "primary" | "secondary" | "success" | "danger";
size?: "sm" | "rg" | "md" | "lg";
disabled?: boolean;
};
export const OutlineButton = React.forwardRef<HTMLButtonElement, Props>(
(
{
children,
onClick,
type = "button",
size = "sm",
className = "",
theme = "primary",
disabled = false,
},
ref
) => (
<button
type={type}
ref={ref}
onClick={onClick}
disabled={disabled}
className={`inline-flex items-center justify-center rounded font-medium duration-300 ${
theme === "primary"
? `${
disabled ? "opacity-70" : ""
} border border-brand-accent text-white shadow-sm hover:bg-brand-accent focus:outline-none`
: theme === "secondary"
? "border bg-transparent hover:bg-brand-surface-1"
: theme === "success"
? `${
disabled ? "opacity-70" : ""
} border border-transparent bg-green-500 text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500`
: `${
disabled ? "opacity-70" : ""
} border border-red-500 text-red-500 shadow-sm hover:bg-red-500 hover:text-white focus:outline-none focus:ring-2 focus:ring-red-500`
} ${
size === "sm"
? "p-2 text-xs"
: size === "md"
? "text-md px-3 py-2"
: size === "lg"
? "text-md px-4 py-2"
: "px-2.5 py-2 text-sm"
} ${className}`}
>
{children}
</button>
)
);
OutlineButton.displayName = "Button";