feat: impl button variant
This commit is contained in:
@@ -1,17 +1,23 @@
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
|
|
||||||
|
const VARIANT_CLASSES = {
|
||||||
|
small: "text-xs py-0",
|
||||||
|
} as const
|
||||||
|
|
||||||
function Button({
|
function Button({
|
||||||
className,
|
className,
|
||||||
|
variant,
|
||||||
...props
|
...props
|
||||||
}: React.DetailedHTMLProps<
|
}: React.DetailedHTMLProps<
|
||||||
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
HTMLButtonElement
|
HTMLButtonElement
|
||||||
>) {
|
> & { variant?: keyof typeof VARIANT_CLASSES }) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
{...props}
|
{...props}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"text-sm bg-neutral-200 dark:bg-neutral-700 px-2 py-1 rounded",
|
"text-sm bg-neutral-200 dark:bg-neutral-700 px-2 py-1 rounded disabled:opacity-20",
|
||||||
|
variant ? VARIANT_CLASSES[variant] : "",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
@@ -53,10 +53,11 @@ const StageItem = memo(({ step }: { step: string }) => {
|
|||||||
{step}
|
{step}
|
||||||
{step !== DEFAULT_NODE.applicationSubmittedNode.key ? (
|
{step !== DEFAULT_NODE.applicationSubmittedNode.key ? (
|
||||||
<Button
|
<Button
|
||||||
|
variant="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteStageInEntry(step, entry.name)
|
deleteStageInEntry(step, entry.name)
|
||||||
}}
|
}}
|
||||||
className="text-xs py-0 invisible group-hover:visible"
|
className="invisible group-hover:visible"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
@@ -126,28 +127,29 @@ const DefaultActions = memo(() => {
|
|||||||
return (
|
return (
|
||||||
<div className="flex flex-row flex-wrap gap-2 pl-4 mt-2">
|
<div className="flex flex-row flex-wrap gap-2 pl-4 mt-2">
|
||||||
<Button
|
<Button
|
||||||
|
variant="small"
|
||||||
|
disabled={isApplicationFinalized}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAddingStage(true)
|
setIsAddingStage(true)
|
||||||
}}
|
}}
|
||||||
className="text-xs py-0"
|
|
||||||
>
|
>
|
||||||
New stage
|
New stage
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
variant="small"
|
||||||
disabled={isApplicationFinalized}
|
disabled={isApplicationFinalized}
|
||||||
className="text-xs py-0"
|
|
||||||
onClick={onAccepted}
|
onClick={onAccepted}
|
||||||
>
|
>
|
||||||
Accepted
|
Accepted
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
variant="small"
|
||||||
disabled={isApplicationFinalized}
|
disabled={isApplicationFinalized}
|
||||||
className="text-xs py-0"
|
|
||||||
onClick={onRejected}
|
onClick={onRejected}
|
||||||
>
|
>
|
||||||
Rejected
|
Rejected
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={onDeleteApplication} className="text-xs py-0">
|
<Button variant="small" onClick={onDeleteApplication}>
|
||||||
Delete application
|
Delete application
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -175,10 +177,10 @@ const AddStageActions = memo(() => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row space-x-2 pl-4 mt-2">
|
<div className="flex flex-row space-x-2 pl-4 mt-2">
|
||||||
<Button onClick={onOk} className="text-xs py-0">
|
<Button variant="small" onClick={onOk}>
|
||||||
Ok
|
Ok
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={onCancel} className="text-xs py-0">
|
<Button variant="small" onClick={onCancel}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user