fix(ui): fix styling of some form elements

This commit is contained in:
psychedelicious 2024-01-23 22:40:05 +11:00 committed by Kent Keirsey
parent a0187cc9df
commit 1178fd8bd3
4 changed files with 135 additions and 106 deletions

View File

@ -1,9 +1,12 @@
import type { FormLabelProps } from '@invoke-ai/ui';
import { import {
Box, Box,
Button, Button,
ButtonGroup,
Checkbox, Checkbox,
Flex, Flex,
FormControl, FormControl,
FormControlGroup,
FormLabel, FormLabel,
IconButton, IconButton,
Popover, Popover,
@ -33,6 +36,10 @@ import {
PiTrashSimpleFill, PiTrashSimpleFill,
} from 'react-icons/pi'; } from 'react-icons/pi';
const formLabelProps: FormLabelProps = {
flexGrow: 1,
};
const IAICanvasMaskOptions = () => { const IAICanvasMaskOptions = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
@ -124,6 +131,7 @@ const IAICanvasMaskOptions = () => {
<PopoverContent> <PopoverContent>
<PopoverBody> <PopoverBody>
<Flex direction="column" gap={2}> <Flex direction="column" gap={2}>
<FormControlGroup formLabelProps={formLabelProps}>
<FormControl> <FormControl>
<FormLabel>{`${t('unifiedCanvas.enableMask')} (H)`}</FormLabel> <FormLabel>{`${t('unifiedCanvas.enableMask')} (H)`}</FormLabel>
<Checkbox <Checkbox
@ -138,12 +146,14 @@ const IAICanvasMaskOptions = () => {
onChange={handleChangePreserveMaskedArea} onChange={handleChangePreserveMaskedArea}
/> />
</FormControl> </FormControl>
</FormControlGroup>
<Box pt={2} pb={2}> <Box pt={2} pb={2}>
<IAIColorPicker <IAIColorPicker
color={maskColor} color={maskColor}
onChange={handleChangeMaskColor} onChange={handleChangeMaskColor}
/> />
</Box> </Box>
<ButtonGroup isAttached={false}>
<Button <Button
size="sm" size="sm"
leftIcon={<PiFloppyDiskBackFill />} leftIcon={<PiFloppyDiskBackFill />}
@ -158,6 +168,7 @@ const IAICanvasMaskOptions = () => {
> >
{t('unifiedCanvas.clearMask')} {t('unifiedCanvas.clearMask')}
</Button> </Button>
</ButtonGroup>
</Flex> </Flex>
</PopoverBody> </PopoverBody>
</PopoverContent> </PopoverContent>

View File

@ -1,7 +1,9 @@
import type { FormLabelProps } from '@invoke-ai/ui';
import { import {
Checkbox, Checkbox,
Flex, Flex,
FormControl, FormControl,
FormControlGroup,
FormLabel, FormLabel,
IconButton, IconButton,
Popover, Popover,
@ -28,6 +30,10 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { PiGearSixBold } from 'react-icons/pi'; import { PiGearSixBold } from 'react-icons/pi';
const formLabelProps: FormLabelProps = {
flexGrow: 1,
};
const IAICanvasSettingsButtonPopover = () => { const IAICanvasSettingsButtonPopover = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
@ -122,6 +128,7 @@ const IAICanvasSettingsButtonPopover = () => {
<PopoverContent> <PopoverContent>
<PopoverBody> <PopoverBody>
<Flex direction="column" gap={2}> <Flex direction="column" gap={2}>
<FormControlGroup formLabelProps={formLabelProps}>
<FormControl> <FormControl>
<FormLabel>{t('unifiedCanvas.showIntermediates')}</FormLabel> <FormLabel>{t('unifiedCanvas.showIntermediates')}</FormLabel>
<Checkbox <Checkbox
@ -144,7 +151,9 @@ const IAICanvasSettingsButtonPopover = () => {
/> />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormLabel>{t('unifiedCanvas.darkenOutsideSelection')}</FormLabel> <FormLabel>
{t('unifiedCanvas.darkenOutsideSelection')}
</FormLabel>
<Checkbox <Checkbox
isChecked={shouldDarkenOutsideBoundingBox} isChecked={shouldDarkenOutsideBoundingBox}
onChange={handleChangeShouldDarkenOutsideBoundingBox} onChange={handleChangeShouldDarkenOutsideBoundingBox}
@ -185,6 +194,7 @@ const IAICanvasSettingsButtonPopover = () => {
onChange={handleChangeShouldAntialias} onChange={handleChangeShouldAntialias}
/> />
</FormControl> </FormControl>
</FormControlGroup>
<ClearCanvasHistoryButtonModal /> <ClearCanvasHistoryButtonModal />
</Flex> </Flex>
</PopoverBody> </PopoverBody>

View File

@ -276,9 +276,9 @@ const IAICanvasToolChooserOptions = () => {
</Flex> </Flex>
<Box w="full" pt={2} pb={2}> <Box w="full" pt={2} pb={2}>
<IAIColorPicker <IAIColorPicker
withNumberInput={true}
color={brushColor} color={brushColor}
onChange={handleChangeBrushColor} onChange={handleChangeBrushColor}
withNumberInput
/> />
</Box> </Box>
</Flex> </Flex>

View File

@ -1,8 +1,10 @@
import type { FormLabelProps } from '@invoke-ai/ui';
import { import {
Checkbox, Checkbox,
CompositeSlider, CompositeSlider,
Flex, Flex,
FormControl, FormControl,
FormControlGroup,
FormLabel, FormLabel,
IconButton, IconButton,
Popover, Popover,
@ -24,6 +26,10 @@ import { RiSettings4Fill } from 'react-icons/ri';
import BoardAutoAddSelect from './Boards/BoardAutoAddSelect'; import BoardAutoAddSelect from './Boards/BoardAutoAddSelect';
const formLabelProps: FormLabelProps = {
flexGrow: 1,
};
const GallerySettingsPopover = () => { const GallerySettingsPopover = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
@ -78,6 +84,7 @@ const GallerySettingsPopover = () => {
defaultValue={90} defaultValue={90}
/> />
</FormControl> </FormControl>
<FormControlGroup formLabelProps={formLabelProps}>
<FormControl> <FormControl>
<FormLabel>{t('gallery.autoSwitchNewImages')}</FormLabel> <FormLabel>{t('gallery.autoSwitchNewImages')}</FormLabel>
<Switch <Switch
@ -92,6 +99,7 @@ const GallerySettingsPopover = () => {
onChange={handleChangeAutoAssignBoardOnClick} onChange={handleChangeAutoAssignBoardOnClick}
/> />
</FormControl> </FormControl>
</FormControlGroup>
<BoardAutoAddSelect /> <BoardAutoAddSelect />
</Flex> </Flex>
</PopoverBody> </PopoverBody>