Skip to content

Commit

Permalink
Merge pull request #87 from aversini/fix(ButtonIcon)-width-and-height…
Browse files Browse the repository at this point in the history
…-are-not-always-identical

fix(ButtonIcon): width and height are not always identical
  • Loading branch information
aversini authored Nov 26, 2023
2 parents b6104f8 + dd99b6a commit 9a6c2c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("ButtonIcon modifiers", () => {
</ButtonIcon>,
);
const button = await screen.findByRole("button");
expectToHaveClasses(button, ["w-6", "p-0"]);
expectToHaveClasses(button, ["h-6", "w-6", "p-0"]);
});

it("should render a size medium button", async () => {
Expand All @@ -103,7 +103,7 @@ describe("ButtonIcon modifiers", () => {
</ButtonIcon>,
);
const button = await screen.findByRole("button");
expectToHaveClasses(button, ["w-8", "p-1"]);
expectToHaveClasses(button, ["h-8", "w-8", "p-1"]);
});

it("should render a size large button", async () => {
Expand All @@ -113,6 +113,6 @@ describe("ButtonIcon modifiers", () => {
</ButtonIcon>,
);
const button = await screen.findByRole("button");
expectToHaveClasses(button, ["w-10", "p-2"]);
expectToHaveClasses(button, ["h-10", "w-10", "p-2"]);
});
});
6 changes: 3 additions & 3 deletions packages/ui-components/src/components/Button/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const getButtonSizesClasses = ({

case TYPE_ICON:
return clsx("inline-flex items-center justify-center", {
"w-6 p-0": size === "small" || slim,
"w-8 p-1": size === "medium" && !slim,
"w-10 p-2": size === "large" && !slim,
"h-6 w-6 p-0": size === "small" || slim,
"h-8 w-8 p-1": size === "medium" && !slim,
"h-10 w-10 p-2": size === "large" && !slim,
});
}
};
Expand Down

0 comments on commit 9a6c2c0

Please sign in to comment.