Skip to content

Commit 979c6e2

Browse files
committed
add settigns button
1 parent e8d322d commit 979c6e2

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/components/Workspaces.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render } from "@/lib/test-utils";
2-
import { screen, waitFor } from "@testing-library/react";
2+
import { screen, waitFor, within } from "@testing-library/react";
33
import { describe, expect, it } from "vitest";
44
import { Workspaces } from "./Workspaces";
55

@@ -32,5 +32,13 @@ describe("Workspaces page", () => {
3232
expect(
3333
screen.getByRole("rowheader", { name: /anotherworkspae/i }),
3434
).toBeVisible();
35+
36+
const firstRow = screen.getByRole("row", { name: /myworkspace/i });
37+
const firstButton = within(firstRow).getByRole("link", {
38+
name: /settings/i,
39+
});
40+
41+
expect(firstButton).toBeVisible();
42+
expect(firstButton).toHaveAttribute("href", "/workspace/myworkspace");
3543
});
3644
});

src/components/Workspaces.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { useWorkspacesData } from "@/hooks/useWorkspacesData";
22
import {
33
Cell,
44
Column,
5+
LinkButton,
56
Row,
67
Table,
78
TableBody,
89
TableHeader,
910
} from "@stacklok/ui-kit";
11+
import { Settings } from "lucide-react";
1012

1113
export function Workspaces() {
1214
const result = useWorkspacesData();
@@ -28,7 +30,15 @@ export function Workspaces() {
2830
{workspaces.map((workspace) => (
2931
<Row key={workspace.name}>
3032
<Cell>{workspace.name}</Cell>
31-
<Cell>hello</Cell>
33+
<Cell>
34+
<LinkButton
35+
href={`/workspace/${workspace.name}`}
36+
variant="tertiary"
37+
>
38+
<Settings />
39+
Settings
40+
</LinkButton>
41+
</Cell>
3242
</Row>
3343
))}
3444
</TableBody>

0 commit comments

Comments
 (0)