Skip to content
Open
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
27 changes: 27 additions & 0 deletions ui/mantine-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/mantine-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mantine/core": "^8.3.13",
"@mantine/hooks": "^8.3.13",
"@tanstack/react-query": "^5.90.21",
"@tabler/icons-react": "^3.36.1",
"highlight.js": "^11.11.1",
"react": "^19.1.0",
"react-dom": "^19.2.4",
Expand Down
6 changes: 6 additions & 0 deletions ui/mantine-ui/src/components/Header.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.header {
background-color: rgb(65, 73, 81);
color: #fff;
border-bottom: 1px solid var(--mantine-color-gray-6);
}

.navMain {
flex: 1;
}
Expand Down
4 changes: 4 additions & 0 deletions ui/mantine-ui/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Link, NavLink, Route, Routes } from 'react-router-dom';
import { AppShell, Button, Group, Menu, Text } from '@mantine/core';
import { ThemeSelector } from '@/components/ThemeSelector';
import { AlertsPage } from '@/pages/Alerts.page';
import { SilencesPage } from '@/pages/Silences.page';
import classes from './Header.module.css';
Expand Down Expand Up @@ -117,6 +118,9 @@ export const Header = () => {
{navLinks}
</Group>
</Group>
<Group visibleFrom="xs" wrap="nowrap" gap="xs">
<ThemeSelector />
</Group>
</Group>
</Group>
</AppShell.Header>
Expand Down
31 changes: 31 additions & 0 deletions ui/mantine-ui/src/components/ThemeSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { FC } from 'react';
import { IconBrightnessFilled, IconMoonFilled, IconSunFilled } from '@tabler/icons-react';
import { ActionIcon, rem, useMantineColorScheme } from '@mantine/core';

export const ThemeSelector: FC = () => {
const { colorScheme, setColorScheme } = useMantineColorScheme();
const iconProps = {
style: { width: rem(20), height: rem(20), display: 'block' },
stroke: 1.5,
};

return (
<ActionIcon
color="gray"
title={`Switch to ${colorScheme === 'light' ? 'dark' : colorScheme === 'dark' ? 'browser-preferred' : 'light'} theme`}
aria-label={`Switch to ${colorScheme === 'light' ? 'dark' : colorScheme === 'dark' ? 'browser-preferred' : 'light'} theme`}
size={32}
onClick={() =>
setColorScheme(colorScheme === 'light' ? 'dark' : colorScheme === 'dark' ? 'auto' : 'light')
}
>
{colorScheme === 'light' ? (
<IconSunFilled {...iconProps} />
) : colorScheme === 'dark' ? (
<IconMoonFilled {...iconProps} />
) : (
<IconBrightnessFilled {...iconProps} />
)}
</ActionIcon>
);
};
Loading