feat(ui): regional prompting layout, styling

This commit is contained in:
psychedelicious
2024-04-12 17:51:19 +10:00
committed by Kent Keirsey
parent e7523bd1d9
commit c1aae0815d
5 changed files with 20 additions and 37 deletions

View File

@ -1,19 +0,0 @@
import type { FlexProps } from '@invoke-ai/ui-library';
import { Flex, forwardRef } from '@invoke-ai/ui-library';
import { useMemo } from 'react';
import type { RgbaColor, RgbColor } from 'react-colorful';
type Props = FlexProps & {
previewColor: RgbColor | RgbaColor;
};
export const ColorPreview = forwardRef((props: Props, ref) => {
const { previewColor, ...rest } = props;
const colorString = useMemo(() => {
if ('a' in previewColor) {
return `rgba(${previewColor.r}, ${previewColor.g}, ${previewColor.b}, ${previewColor.a ?? 1})`;
}
return `rgba(${previewColor.r}, ${previewColor.g}, ${previewColor.b}, 1)`;
}, [previewColor]);
return <Flex ref={ref} w="full" h="full" borderRadius="base" backgroundColor={colorString} {...rest} />;
});