From 176d41d624466b58d40bd6a3995f5e61caf5146c Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed, 30 Aug 2023 05:05:54 +1200 Subject: [PATCH] ui: Add SubParametersWrapper --- .../ParamCompositingSettingsCollapse.tsx | 40 ++++--------------- .../ParamInfillAndScalingCollapse.tsx | 18 ++++++--- .../Parameters/SubParametersWrapper.tsx | 39 ++++++++++++++++++ 3 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 invokeai/frontend/web/src/features/parameters/components/Parameters/SubParametersWrapper.tsx diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/Compositing/ParamCompositingSettingsCollapse.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/Compositing/ParamCompositingSettingsCollapse.tsx index a13fa01220..c3c978e8a1 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/Compositing/ParamCompositingSettingsCollapse.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/Compositing/ParamCompositingSettingsCollapse.tsx @@ -1,7 +1,8 @@ -import { Divider, Flex, Text } from '@chakra-ui/react'; +import { Divider, Flex } from '@chakra-ui/react'; import IAICollapse from 'common/components/IAICollapse'; -import { PropsWithChildren, memo } from 'react'; +import { memo } from 'react'; import { useTranslation } from 'react-i18next'; +import SubParametersWrapper from '../../SubParametersWrapper'; import ParamCanvasCoherenceSteps from './CoherencePass/ParamCanvasCoherenceSteps'; import ParamCanvasCoherenceStrength from './CoherencePass/ParamCanvasCoherenceStrength'; import ParamMaskBlur from './MaskAdjustment/ParamMaskBlur'; @@ -13,45 +14,18 @@ const ParamCompositingSettingsCollapse = () => { return ( - - - {t('parameters.maskAdjustmentsHeader')} - + - + - - - {t('parameters.coherencePassHeader')} - + - + ); }; -const CompositingSettingsWrapper = memo((props: PropsWithChildren) => ( - - {props.children} - -)); - -CompositingSettingsWrapper.displayName = 'CompositingSettingsWrapper'; - export default memo(ParamCompositingSettingsCollapse); diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse.tsx index 2951a7dee3..f2da288e59 100644 --- a/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse.tsx @@ -1,8 +1,9 @@ -import { Flex } from '@chakra-ui/react'; +import { Divider, Flex } from '@chakra-ui/react'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import IAICollapse from 'common/components/IAICollapse'; +import SubParametersWrapper from '../../SubParametersWrapper'; import ParamInfillMethod from './ParamInfillMethod'; import ParamInfillTilesize from './ParamInfillTilesize'; import ParamScaleBeforeProcessing from './ParamScaleBeforeProcessing'; @@ -15,11 +16,16 @@ const ParamInfillCollapse = () => { return ( - - - - - + + + + + + + + + + ); diff --git a/invokeai/frontend/web/src/features/parameters/components/Parameters/SubParametersWrapper.tsx b/invokeai/frontend/web/src/features/parameters/components/Parameters/SubParametersWrapper.tsx new file mode 100644 index 0000000000..e03b80bc8f --- /dev/null +++ b/invokeai/frontend/web/src/features/parameters/components/Parameters/SubParametersWrapper.tsx @@ -0,0 +1,39 @@ +import { Flex, Text } from '@chakra-ui/react'; +import { ReactNode, memo } from 'react'; + +type SubParameterWrapperProps = { + children: ReactNode[]; + label?: string; +}; + +const SubParametersWrapper = (props: SubParameterWrapperProps) => ( + + {props.label && ( + + {props.label} + + )} + {props.children} + +); + +SubParametersWrapper.displayName = 'SubSettingsWrapper'; + +export default memo(SubParametersWrapper);