Skip to content

Commit c827a08

Browse files
authored
refactor: migrate deployment banner to Tailwind and radix (coder#20479)
before: <img width="1667" height="48" alt="Screenshot 2025-10-25 at 18 02 45" src="https://github.com/user-attachments/assets/1525a01e-5976-4d0e-8280-1b9ae8d91197" /> after: <img width="1662" height="35" alt="Screenshot 2025-10-25 at 18 02 17" src="https://github.com/user-attachments/assets/d0fd7b69-ee88-4986-a539-5917c17a8b85" />
1 parent 1b6556c commit c827a08

File tree

3 files changed

+252
-257
lines changed

3 files changed

+252
-257
lines changed

site/src/components/Link/Link.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ interface LinkProps
2727
extends React.AnchorHTMLAttributes<HTMLAnchorElement>,
2828
VariantProps<typeof linkVariants> {
2929
asChild?: boolean;
30+
showExternalIcon?: boolean;
3031
}
3132

3233
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
33-
({ className, children, size, asChild, ...props }, ref) => {
34+
(
35+
{ className, children, size, asChild, showExternalIcon = true, ...props },
36+
ref,
37+
) => {
3438
const Comp = asChild ? Slot : "a";
3539
return (
3640
<Comp
@@ -39,7 +43,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
3943
{...props}
4044
>
4145
<Slottable>{children}</Slottable>
42-
<SquareArrowOutUpRightIcon aria-hidden="true" />
46+
{showExternalIcon && <SquareArrowOutUpRightIcon aria-hidden="true" />}
4347
</Comp>
4448
);
4549
},

site/src/modules/dashboard/DeploymentBanner/DeploymentBannerView.stories.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
MockDeploymentStats,
44
} from "testHelpers/entities";
55
import type { Meta, StoryObj } from "@storybook/react-vite";
6+
import { expect, screen, userEvent, waitFor, within } from "storybook/test";
67
import { DeploymentBannerView } from "./DeploymentBannerView";
78

89
const meta: Meta<typeof DeploymentBannerView> = {
@@ -22,6 +23,14 @@ export const WithHealthIssues: Story = {
2223
args: {
2324
health: DeploymentHealthUnhealthy,
2425
},
26+
play: async ({ canvasElement }) => {
27+
const canvas = within(canvasElement);
28+
const trigger = canvas.getByTestId("deployment-health-trigger");
29+
await userEvent.hover(trigger);
30+
await waitFor(() =>
31+
expect(screen.getByRole("tooltip")).toBeInTheDocument(),
32+
);
33+
},
2534
};
2635

2736
export const WithDismissedHealthIssues: Story = {
@@ -34,4 +43,12 @@ export const WithDismissedHealthIssues: Story = {
3443
},
3544
},
3645
},
46+
play: async ({ canvasElement }) => {
47+
const canvas = within(canvasElement);
48+
const trigger = canvas.getByTestId("deployment-health-trigger");
49+
await userEvent.hover(trigger);
50+
await waitFor(() =>
51+
expect(screen.getByRole("tooltip")).toBeInTheDocument(),
52+
);
53+
},
3754
};

0 commit comments

Comments
 (0)