refactoring

This commit is contained in:
2023-12-11 17:31:38 +05:00
parent 8b087e6b24
commit 40427e6411
4 changed files with 11 additions and 7 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
interface ButtonProps {
text?: string;
icon?: React.ReactNode;
type?: "primary" | "secondary" | "tertiary" | "disabled";
variant?: "primary" | "secondary" | "tertiary" | "disabled";
width?: "full" | "fit";
disabled?: boolean;
onClick?: () => void;
@@ -10,13 +10,13 @@ interface ButtonProps {
function Button({
text,
icon,
type = "primary",
variant = "primary",
width = "fit",
disabled,
onClick,
}: ButtonProps) {
if (disabled) {
type = "disabled";
variant = "disabled";
}
const onlyIcon = !!icon && !text;
@@ -32,7 +32,7 @@ function Button({
};
const types = () => {
switch (type) {
switch (variant) {
case "primary":
return "text-white bg-[#49A1F5] hover:bg-[#4190DB]";
case "secondary":
@@ -21,7 +21,11 @@ const CompanyInfoItem = ({ companyInfoItem }: CompanyInfoItemProps) => {
<div className="text-[#77828C] text-[12px]">{label}</div>
<div className="text-[14px]">{title}</div>
</div>
<Button icon={<CopyIcon />} type="tertiary" onClick={handleOnCopyClick} />
<Button
icon={<CopyIcon />}
variant="tertiary"
onClick={handleOnCopyClick}
/>
</div>
);
};
@@ -100,7 +100,7 @@ const CompanyInfo = () => {
{tab === "Сотрудники" && (
<div className="border-b p-4 pt-0 ">
<EmployeesList employees={companyEmployeeItems} />
<Button text="Добавить" width="full" type="secondary" />
<Button text="Добавить" width="full" variant="secondary" />
</div>
)}
{tab === "Проекты" && <ProjectList projectItems={projectItems} />}
@@ -41,7 +41,7 @@ const EmployeeItem = ({ employee }: EmployeeItemProps) => {
</div>
</div>
<Button type="tertiary" icon={<MoreIcon />} />
<Button variant="tertiary" icon={<MoreIcon />} />
</div>
</div>
);