-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathApp.tsx
72 lines (67 loc) · 2.17 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import {
Button,
Card,
Divider,
Flex,
Group,
Image,
NavLink,
Space,
Stack,
Switch,
Tabs,
Text,
ThemeIcon,
Title,
UnstyledButton,
} from '@mantine/core';
import {AppShell, Navbar, Header} from '@mantine/core';
import {IconBackpack, IconBuildingStore, IconGitPullRequest, IconInfoCircle, IconSettings} from '@tabler/icons-react';
import {SettingsPage} from './settings/SettingsPage';
import {useState} from 'react';
const ALL_PAGE_IDS = ['settings'] as const;
type PageId = (typeof ALL_PAGE_IDS)[number];
const pageIdToComponent = (pageId: PageId) => {
switch (pageId) {
case 'settings':
return <SettingsPage />;
}
};
export const App = () => {
const [activePageId, setActivePageId] = useState<PageId>('settings');
return (
<AppShell
padding="md"
navbar={
<Navbar width={{base: 300}} p="xs">
<Flex direction="column" gap="xs">
<NavLink
label={<Text size="sm">Settings</Text>}
icon={
<ThemeIcon color="blue" variant="light">
<IconSettings size="1rem" />
</ThemeIcon>
}
variant="light"
active={activePageId === 'settings'}
onClick={() => setActivePageId('settings')}
/>
</Flex>
</Navbar>
}
header={
<Header height={60} p="xs">
<Group pl="md">
<Image width={130} src="https://csfloat.com/assets/n_full_logo.png" alt="CSFloat Logo" />
<Title order={2}>Market Checker</Title>
</Group>
</Header>
}
styles={(theme) => ({
main: {backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0]},
})}
>
{pageIdToComponent(activePageId)}
</AppShell>
);
};