Skip to content

Commit

Permalink
Convert theme picker to Phosphor icons
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Sep 9, 2024
1 parent c771afa commit ac5a7f9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/components/common/tabbed-options.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { Icon, IconProp } from '../../icons';
import { Icon, IconKey } from '../../icons';
import { styled, css } from '../../styles';
import { omit } from 'lodash';
import { UnstyledButton } from './inputs';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const TabsContainer = styled((p: {
export const Tab = styled((p: {
className?: string,
selected?: boolean,
icon: IconProp,
icon: IconKey,
value: any,
children: React.ReactNode
}) =>
Expand All @@ -56,7 +56,7 @@ export const Tab = styled((p: {
event.tabValue = p.value;
}}
>
<Icon icon={p.icon} size='2x' />
<Icon icon={p.icon} />
{ p.children }
</UnstyledButton>
)`
Expand Down Expand Up @@ -89,5 +89,7 @@ export const Tab = styled((p: {
> svg {
margin-bottom: 10px;
width: 2em;
height: auto;
}
`;
8 changes: 4 additions & 4 deletions src/components/settings/settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,25 +300,25 @@ class SettingsPage extends React.Component<SettingsPageProps> {
}}
>
<Tab
icon={['fas', 'magic']}
icon='MagicWand'
value='automatic'
>
Automatic
</Tab>
<Tab
icon={['fas', 'sun']}
icon='Sun'
value='light'
>
Light
</Tab>
<Tab
icon={['fas', 'moon']}
icon='Moon'
value='dark'
>
Dark
</Tab>
<Tab
icon={['fas', 'adjust']}
icon='CircleHalf'
value='high-contrast'
>
High Contrast
Expand Down
8 changes: 8 additions & 0 deletions src/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import {
Plug,
QuestionMark,
ArrowLeft,
MagicWand,
Sun,
Moon,
CircleHalf
} from '@phosphor-icons/react';

export type IconKey = keyof typeof Icons;
Expand Down Expand Up @@ -46,6 +50,10 @@ const Icons = {
Plug,
QuestionMark,
ArrowLeft,
MagicWand,
Sun,
Moon,
CircleHalf
} as const;

// Import required FA icons:
Expand Down

0 comments on commit ac5a7f9

Please sign in to comment.