mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Adds theme changer popover
This commit is contained in:
parent
548bcaceb2
commit
dfc0c587b1
@ -24,14 +24,3 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
column-gap: 0.5rem;
|
column-gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-changer-dropdown {
|
|
||||||
.invokeai__select-picker {
|
|
||||||
background-color: var(--background-color-light) !important;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
&:focus {
|
|
||||||
border: none !important;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -33,8 +33,6 @@ const StatusIndicator = () => {
|
|||||||
wasErrorSeen,
|
wasErrorSeen,
|
||||||
} = useAppSelector(systemSelector);
|
} = useAppSelector(systemSelector);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
// const statusMessageTextColor =
|
|
||||||
// isConnected && !hasError ? 'green.500' : 'red.500';
|
|
||||||
|
|
||||||
let statusStyle;
|
let statusStyle;
|
||||||
if (isConnected && !hasError) {
|
if (isConnected && !hasError) {
|
||||||
@ -84,7 +82,6 @@ const StatusIndicator = () => {
|
|||||||
cursor={statusIndicatorCursor}
|
cursor={statusIndicatorCursor}
|
||||||
onClick={handleClickStatusIndicator}
|
onClick={handleClickStatusIndicator}
|
||||||
className={`status ${statusStyle}`}
|
className={`status ${statusStyle}`}
|
||||||
// textColor={statusMessageTextColor}
|
|
||||||
>
|
>
|
||||||
{statusMessage}
|
{statusMessage}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { useColorMode } from '@chakra-ui/react';
|
import { useColorMode, VStack } from '@chakra-ui/react';
|
||||||
import React, { ChangeEvent } from 'react';
|
|
||||||
import { RootState, useAppDispatch, useAppSelector } from 'app/store';
|
import { RootState, useAppDispatch, useAppSelector } from 'app/store';
|
||||||
import IAISelect from 'common/components/IAISelect';
|
|
||||||
import { setCurrentTheme } from 'features/options/store/optionsSlice';
|
import { setCurrentTheme } from 'features/options/store/optionsSlice';
|
||||||
|
import IAIPopover from 'common/components/IAIPopover';
|
||||||
|
import IAIIconButton from 'common/components/IAIIconButton';
|
||||||
|
import { FaCheck, FaPalette } from 'react-icons/fa';
|
||||||
|
import IAIButton from 'common/components/IAIButton';
|
||||||
|
|
||||||
const THEMES = ['dark', 'light', 'green'];
|
const THEMES = ['dark', 'light', 'green'];
|
||||||
|
|
||||||
@ -13,17 +15,39 @@ export default function ThemeChanger() {
|
|||||||
(state: RootState) => state.options.currentTheme
|
(state: RootState) => state.options.currentTheme
|
||||||
);
|
);
|
||||||
|
|
||||||
const themeChangeHandler = (e: ChangeEvent<HTMLSelectElement>) => {
|
const handleChangeTheme = (theme: string) => {
|
||||||
setColorMode(e.target.value);
|
setColorMode(theme);
|
||||||
dispatch(setCurrentTheme(e.target.value));
|
dispatch(setCurrentTheme(theme));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IAISelect
|
<IAIPopover
|
||||||
validValues={THEMES}
|
trigger="hover"
|
||||||
value={currentTheme}
|
triggerComponent={
|
||||||
onChange={themeChangeHandler}
|
<IAIIconButton
|
||||||
styleClass="theme-changer-dropdown"
|
aria-label="Theme"
|
||||||
></IAISelect>
|
size={'sm'}
|
||||||
|
variant="link"
|
||||||
|
data-variant="link"
|
||||||
|
fontSize={20}
|
||||||
|
icon={<FaPalette />}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<VStack align={'stretch'}>
|
||||||
|
{THEMES.map((theme) => (
|
||||||
|
<IAIButton
|
||||||
|
style={{
|
||||||
|
width: '6rem',
|
||||||
|
}}
|
||||||
|
leftIcon={currentTheme === theme ? <FaCheck /> : undefined}
|
||||||
|
size={'sm'}
|
||||||
|
onClick={() => handleChangeTheme(theme)}
|
||||||
|
>
|
||||||
|
{theme.charAt(0).toUpperCase() + theme.slice(1)}
|
||||||
|
</IAIButton>
|
||||||
|
))}
|
||||||
|
</VStack>
|
||||||
|
</IAIPopover>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user