Skip to content

Commit ddf71de

Browse files
author
root
committed
Align button module with legacy btn styles
1 parent 2d5ec67 commit ddf71de

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

packages/web/src/components/ui/button/index.module.css

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
justify-content: center;
66
gap: var(--sp-2);
77
height: var(--btn-height-md);
8-
min-height: var(--touch-target-min);
98
padding: 0 var(--sp-4);
109
border: 1px solid transparent;
1110
border-radius: var(--radius-md);
@@ -14,35 +13,24 @@
1413
font-weight: var(--font-medium);
1514
line-height: 1;
1615
white-space: nowrap;
17-
text-decoration: none;
1816
transition:
1917
background var(--duration-normal) var(--ease-out),
2018
border-color var(--duration-normal) var(--ease-out),
2119
color var(--duration-normal) var(--ease-out),
2220
box-shadow var(--duration-normal) var(--ease-out),
2321
transform var(--duration-fast) var(--ease-out);
24-
cursor: pointer;
2522
}
2623

2724
.btn:focus-visible,
2825
:global(.btn):focus-visible {
2926
box-shadow:
30-
0 0 0 calc(var(--sp-1) / 2) var(--bg-page),
31-
0 0 0 var(--sp-1) var(--border-focus);
27+
0 0 0 2px var(--bg-page),
28+
0 0 0 4px rgba(108, 182, 255, 0.35);
3229
}
3330

34-
.btn:hover:not(:disabled):not([aria-disabled="true"]),
35-
:global(.btn):hover:not(:disabled):not([aria-disabled="true"]) {
36-
transform: translateY(calc(var(--sp-1) / -4));
37-
}
38-
39-
.btn:disabled,
40-
.btn[aria-disabled="true"],
41-
:global(.btn):disabled,
42-
:global(.btn[aria-disabled="true"]) {
43-
opacity: 0.5;
44-
cursor: not-allowed;
45-
transform: none;
31+
.btn:hover:not(:disabled),
32+
:global(.btn):hover:not(:disabled) {
33+
transform: translateY(-1px);
4634
}
4735

4836
.primary,
@@ -53,7 +41,7 @@
5341

5442
.primary:hover:not(:disabled):not([aria-disabled="true"]),
5543
:global(.btn-primary):hover:not(:disabled):not([aria-disabled="true"]) {
56-
background: color-mix(in srgb, var(--accent-blue) 84%, var(--bg-surface) 16%);
44+
background: color-mix(in srgb, var(--accent-blue) 84%, white 16%);
5745
}
5846

5947
.secondary,
@@ -92,17 +80,15 @@
9280

9381
.sm,
9482
:global(.btn-sm) {
95-
height: var(--btn-height-sm);
96-
min-height: var(--touch-target-min);
83+
height: 24px;
9784
padding: 0 var(--sp-2);
9885
border-radius: var(--radius-sm);
9986
font-size: var(--text-xs);
10087
}
10188

10289
.lg,
10390
:global(.btn-lg) {
104-
height: var(--btn-height-lg);
105-
min-height: var(--touch-target-min);
91+
height: 40px;
10692
padding: 0 var(--sp-6);
10793
border-radius: var(--radius-lg);
10894
font-size: var(--text-lg);

packages/web/src/components/ui/button/index.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,20 @@ describe("Button", () => {
109109

110110
expect(screen.getByRole("link", { name: "Settings" })).toHaveAttribute("href", "/settings");
111111
});
112+
113+
it("preserves legacy classes and loading semantics for anchors", () => {
114+
render(
115+
<Button as="a" href="/settings" loading variant="ghost" size="sm">
116+
Settings
117+
</Button>
118+
);
119+
120+
expect(screen.getByRole("link", { name: "Settings" })).toHaveClass(
121+
"btn",
122+
"btn-ghost",
123+
"btn-sm"
124+
);
125+
expect(screen.getByRole("link", { name: "Settings" })).toHaveAttribute("aria-busy", "true");
126+
expect(screen.getByRole("link", { name: "Settings" })).not.toHaveAttribute("disabled");
127+
});
112128
});

0 commit comments

Comments
 (0)