Skip to content

Commit

Permalink
refactored with twmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
dyzhuu committed Aug 15, 2023
1 parent 36b3f21 commit 8cb76c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { twMerge } from "tailwind-merge";

/**
* @param label button text
Expand All @@ -10,12 +11,14 @@ const Button = ({widthFull, onClick, disabled, label}: ButtonInputProps) => {
return (
//TODO: colours
<button
className={`h-14 rounded text-white font-semibold text-sm bg-[#3767af] active:bg-[#264a7f] disabled:bg-[#BFBFBF]
${widthFull ? "w-full" : "w-72"}`}
className={twMerge(
"h-14 rounded text-white font-semibold text-sm bg-[#3767af] active:bg-[#264a7f] disabled:bg-[#BFBFBF] uppercase",
widthFull ? "w-full" : "w-72",
)}
onClick={onClick}
disabled={disabled}
>
{label.toUpperCase()}
{label}
</button>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import { PropsWithChildren } from "react";
import CardProps from "./CardProps";
import { twMerge } from "tailwind-merge";

const Card = ({onClick, className, children} : PropsWithChildren<CardProps>) => {
return (
<div onClick={onClick} className={`rounded-md ` + className}>
<div onClick={onClick} className={twMerge("rounded-md", className)}>
{children}
</div>
);
Expand Down

0 comments on commit 8cb76c4

Please sign in to comment.