Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions client/apps/webapp/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// ------
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import { GlobalComponents } from 'vue'

export {}

Expand All @@ -18,11 +17,3 @@ declare module 'vue' {
UserNav: typeof import('./src/components/UserNav.vue')['default']
}
}

// For TSX support
declare global {
const RouterLink: typeof import('vue-router')['RouterLink']
const RouterView: typeof import('vue-router')['RouterView']
const ThemeSwitcher: typeof import('./src/components/ThemeSwitcher.vue')['default']
const UserNav: typeof import('./src/components/UserNav.vue')['default']
}
29 changes: 29 additions & 0 deletions client/apps/webapp/src/components/ThemeSwitcher.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { axe } from "vitest-axe";

Check failure on line 1 in client/apps/webapp/src/components/ThemeSwitcher.spec.ts

View workflow job for this annotation

GitHub Actions / Lint Frontend (Biome)

format

File content differs from formatting output

Check failure on line 1 in client/apps/webapp/src/components/ThemeSwitcher.spec.ts

View workflow job for this annotation

GitHub Actions / Lint Frontend (Biome)

assist/source/organizeImports

The imports and exports are not sorted.
import { render, cleanup } from "@testing-library/vue";
import ThemeSwitcher from "./ThemeSwitcher.vue";
import { expect, it, describe, vi, afterEach } from "vitest";

vi.mock("@/composables/useTheme", () => ({
useTheme: () => ({
theme: "light",
resolvedTheme: "light",
setTheme: vi.fn(),
}),
}));

describe("ThemeSwitcher", () => {
afterEach(() => {
cleanup();
});

it("should have no accessibility violations", async () => {
const { container } = render(ThemeSwitcher);
const results = await axe(container);
expect(results).toHaveNoViolations();
});

it("should render the component", () => {
const { getByRole } = render(ThemeSwitcher);
expect(getByRole("button", { name: /select theme/i })).toBeTruthy();
});
});
11 changes: 9 additions & 2 deletions client/apps/webapp/src/components/ThemeSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ const themes = [
<DropdownMenuTrigger as-child>
<Button variant="ghost" size="icon">
<span class="sr-only">Select theme</span>
<PhSunLight class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<PhMoonLight class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<PhSunLight
:class="['h-[1.2rem] w-[1.2rem] transition-all', resolvedTheme === 'light' ? 'rotate-0 scale-100' : 'rotate-90 scale-0']"
/>
<PhMoonLight
:class="['absolute h-[1.2rem] w-[1.2rem] transition-all', resolvedTheme === 'dark' ? 'rotate-0 scale-100' : '-rotate-90 scale-0']"
/>
<PhMonitorLight
:class="['absolute h-[1.2rem] w-[1.2rem] transition-all', resolvedTheme === 'system' ? 'rotate-0 scale-100' : '-rotate-90 scale-0']"
/>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
Expand Down
Loading