Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ export const buttonVariants = cva("disabled:cursor-not-allowed block", {
{
variant: "main",
isLoading: true,
className: "disabled:bg-textColor disabled:border-textColor",
className: "disabled:!bg-textColor disabled:!border-textColor",
},
{
variant: "secondary",
isLoading: true,
className: "disabled:!bg-textColor disabled:!border-textColor disabled:!text-bgColor",
},
],
defaultVariants: {
Expand Down Expand Up @@ -148,7 +153,9 @@ export function Button({
);
}

return <Loader type={loadingType} reverse={loadingReverse} />;
// For secondary and main variants with loading, use white loader on black background
const shouldReverseLoader = variant === "secondary" || variant === "main";
return <Loader type={loadingType} reverse={shouldReverseLoader} />;
};

return (
Expand Down
7 changes: 6 additions & 1 deletion src/components/ui/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export function Loader({
return (
<div className="flex w-full justify-center p-2">
<div className="relative h-[0.5px] w-full overflow-hidden bg-gray-200/20 lg:w-[175px]">
<div className="absolute left-0 top-0 h-full w-full animate-[loading_1s_ease-out_forwards] bg-bgColor" />
<div
className={cn(
"absolute left-0 top-0 h-full w-full animate-[loading_1s_ease-out_forwards]",
reverse ? "bg-bgColor" : "bg-textColor",
)}
/>
</div>
</div>
);
Expand Down