Skip to content

Commit

Permalink
feat: enable theme selection
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <adam.setch@outlook.com>
  • Loading branch information
setchy committed Oct 22, 2024
1 parent 5c10ab0 commit 08555b8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 56 deletions.
39 changes: 13 additions & 26 deletions src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ import { AtlasIcon } from '@atlaskit/logo';
import { Box, Stack } from '@atlaskit/primitives';
import Spinner from '@atlaskit/spinner';
import Toggle from '@atlaskit/toggle';
import { token } from '@atlaskit/tokens';
import Tooltip from '@atlaskit/tooltip';

import { colors } from '../../../tailwind.config';
import { AppContext } from '../context/App';
import { Theme } from '../types';
import { quitApp } from '../utils/comms';
import { hasFiltersSet } from '../utils/filters';
import { openMyNotifications } from '../utils/links';
import { getNotificationCount } from '../utils/notifications/notifications';
import { getTheme } from '../utils/theme';

export const Sidebar: FC = () => {
const navigate = useNavigate();
Expand Down Expand Up @@ -76,16 +73,9 @@ export const Sidebar: FC = () => {
}, [settings]);

return (
<div className="fixed left-12 -ml-12 flex h-full w-12 flex-col overflow-y-auto ">
<div className="fixed left-12 -ml-12 flex h-full w-12 flex-col overflow-y-auto bg-sidebar dark:bg-dark-sidebar">
<div className="flex flex-1 flex-col items-center">
<Box
paddingBlockStart="space.200"
backgroundColor={
getTheme() === Theme.DARK
? 'color.background.accent.blue.subtlest'
: 'color.background.accent.blue.subtlest.hovered'
}
>
<Box paddingBlockStart="space.200">
<Stack alignInline="center" space="space.100">
<Tooltip content="Home" position="right">
<IconButton
Expand Down Expand Up @@ -114,7 +104,7 @@ export const Sidebar: FC = () => {
<NotificationIcon
{...iconProps}
size="small"
primaryColor={token('color.icon.inverse')}
primaryColor="white"
/>
)}
appearance={notificationsCount > 0 ? 'primary' : 'subtle'}
Expand Down Expand Up @@ -156,7 +146,7 @@ export const Sidebar: FC = () => {
<ListIcon
label="groupByProduct"
size="small"
primaryColor={token('color.icon.inverse')}
primaryColor="white"
/>
)}
onClick={() => {
Expand All @@ -183,7 +173,7 @@ export const Sidebar: FC = () => {
<FilterIcon
{...iconProps}
size="small"
primaryColor={token('color.icon.inverse')}
primaryColor="white"
/>
)}
appearance={hasFilters ? 'discovery' : 'subtle'}
Expand All @@ -199,14 +189,7 @@ export const Sidebar: FC = () => {
</Box>
</div>

<Box
paddingBlockEnd="space.200"
backgroundColor={
getTheme() === Theme.DARK
? 'color.background.accent.gray.subtlest'
: 'color.background.accent.blue.subtle'
}
>
<Box paddingBlockEnd="space.200">
<Stack alignInline="center" space="space.150">
{isLoggedIn ? (
<Fragment>
Expand All @@ -224,7 +207,7 @@ export const Sidebar: FC = () => {
<RefreshIcon
{...iconProps}
size="medium"
primaryColor={token('color.icon.inverse')}
primaryColor="white"
/>
)
}
Expand All @@ -240,7 +223,11 @@ export const Sidebar: FC = () => {
<IconButton
label="Settings"
icon={(iconProps) => (
<SettingsIcon {...iconProps} size="medium" />
<SettingsIcon
{...iconProps}
size="medium"
primaryColor="white"
/>
)}
appearance="subtle"
shape="circle"
Expand All @@ -257,7 +244,7 @@ export const Sidebar: FC = () => {
<CrossCircleIcon
{...iconProps}
size="medium"
primaryColor={token('color.icon.inverse')}
primaryColor="white"
secondaryColor={colors.sidebar}
/>
)}
Expand Down
58 changes: 29 additions & 29 deletions src/renderer/components/__snapshots__/Sidebar.test.tsx.snap

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

4 changes: 3 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { B200 } from '@atlaskit/theme/colors';
import { B200, N800 } from '@atlaskit/theme/colors';

import type { Config } from 'tailwindcss';

export const colors = {
sidebar: B200,
'dark-sidebar': N800,
};

const config: Config = {
Expand Down

0 comments on commit 08555b8

Please sign in to comment.