From ccbbb417f9d956e7e380668cea88a109a7e51f92 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:06:01 +1100 Subject: [PATCH] feat(ui): fix control adapters styling --- .../src/common/components/InvControl/theme.ts | 3 +- .../components/ControlAdapterConfig.tsx | 43 +++++++++---------- .../ControlAdapterShouldAutoConfig.tsx | 11 ++++- .../ParamControlAdapterBeginEnd.tsx | 1 + .../parameters/ParamControlAdapterWeight.tsx | 1 + .../processors/common/ProcessorWrapper.tsx | 2 +- 6 files changed, 35 insertions(+), 26 deletions(-) diff --git a/invokeai/frontend/web/src/common/components/InvControl/theme.ts b/invokeai/frontend/web/src/common/components/InvControl/theme.ts index 8c8c4ceb9a..037bf06cbc 100644 --- a/invokeai/frontend/web/src/common/components/InvControl/theme.ts +++ b/invokeai/frontend/web/src/common/components/InvControl/theme.ts @@ -14,8 +14,7 @@ const formBaseStyle = definePartsStyle((props) => { display: 'flex', flexDirection: props.orientation === 'vertical' ? 'column' : 'row', alignItems: props.orientation === 'vertical' ? 'flex-start' : 'center', - gap: 4, - // h: props.orientation === 'vertical' ? 'unset' : 8, + gap: props.orientation === 'vertical' ? 2 : 4, }, }; }); diff --git a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterConfig.tsx b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterConfig.tsx index cc5379b50d..31e1c6378b 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterConfig.tsx +++ b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterConfig.tsx @@ -2,6 +2,7 @@ import { ChevronUpIcon } from '@chakra-ui/icons'; import { Box, Flex } from '@chakra-ui/react'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { InvControl } from 'common/components/InvControl/InvControl'; +import type { InvLabelProps } from 'common/components/InvControl/types'; import { InvIconButton } from 'common/components/InvIconButton/InvIconButton'; import { InvSwitch } from 'common/components/InvSwitch/wrapper'; import { useControlAdapterIsEnabled } from 'features/controlAdapters/hooks/useControlAdapterIsEnabled'; @@ -29,6 +30,10 @@ import ParamControlAdapterProcessorSelect from './parameters/ParamControlAdapter import ParamControlAdapterResizeMode from './parameters/ParamControlAdapterResizeMode'; import ParamControlAdapterWeight from './parameters/ParamControlAdapterWeight'; +const labelProps: InvLabelProps = { + flexGrow: 1, +}; + const ControlAdapterConfig = (props: { id: string; number: number }) => { const { id, number } = props; const controlAdapterType = useControlAdapterType(id); @@ -66,14 +71,17 @@ const ControlAdapterConfig = (props: { id: string; number: number }) => { return ( - + { /> - + { /> - + - + @@ -153,23 +152,23 @@ const ControlAdapterConfig = (props: { id: string; number: number }) => { )} - - - - - {isExpanded && ( <> + + + + + diff --git a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterShouldAutoConfig.tsx b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterShouldAutoConfig.tsx index 12c1fa01ae..07a13ba1c5 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterShouldAutoConfig.tsx +++ b/invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterShouldAutoConfig.tsx @@ -1,5 +1,6 @@ import { useAppDispatch } from 'app/store/storeHooks'; import { InvControl } from 'common/components/InvControl/InvControl'; +import type { InvLabelProps } from 'common/components/InvControl/types'; import { InvSwitch } from 'common/components/InvSwitch/wrapper'; import { useControlAdapterIsEnabled } from 'features/controlAdapters/hooks/useControlAdapterIsEnabled'; import { useControlAdapterShouldAutoConfig } from 'features/controlAdapters/hooks/useControlAdapterShouldAutoConfig'; @@ -12,6 +13,10 @@ type Props = { id: string; }; +const labelProps: InvLabelProps = { + flexGrow: 1, +}; + const ControlAdapterShouldAutoConfig = ({ id }: Props) => { const isEnabled = useControlAdapterIsEnabled(id); const shouldAutoConfig = useControlAdapterShouldAutoConfig(id); @@ -27,7 +32,11 @@ const ControlAdapterShouldAutoConfig = ({ id }: Props) => { } return ( - + { isDisabled={!isEnabled} label={t('controlnet.beginEndStepPercent')} feature="controlNetBeginEnd" + orientation="vertical" > { label={t('controlnet.weight')} isDisabled={!isEnabled} feature="controlNetWeight" + orientation="vertical" > + {props.children} );