fix(ui): dnd drop label errors w invalid DOM nesting

Make em all strings to prevent nesting `<p>` elements. Slightly changes appearance - font size is a bit smaller.
This commit is contained in:
psychedelicious
2024-09-17 22:44:15 +10:00
parent c4541f5d3c
commit 9884159812
6 changed files with 6 additions and 20 deletions

View File

@@ -66,7 +66,7 @@ type IAIDndImageProps = FlexProps & {
fitContainer?: boolean;
droppableData?: TypesafeDroppableData;
draggableData?: TypesafeDraggableData;
dropLabel?: ReactNode;
dropLabel?: string;
isSelected?: boolean;
isSelectedForCompare?: boolean;
thumbnail?: boolean;

View File

@@ -1,13 +1,12 @@
import { Flex, Text } from '@invoke-ai/ui-library';
import type { AnimationProps } from 'framer-motion';
import { motion } from 'framer-motion';
import type { ReactNode } from 'react';
import { memo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { v4 as uuidv4 } from 'uuid';
type Props = {
isOver: boolean;
label?: ReactNode;
label?: string;
};
const initial: AnimationProps['initial'] = {
@@ -64,7 +63,7 @@ const IAIDropOverlay = (props: Props) => {
p={4}
>
<Text
fontSize="xl"
fontSize="lg"
fontWeight="semibold"
color={isOver ? 'invokeYellow.300' : 'base.500'}
transitionProperty="common"

View File

@@ -3,14 +3,13 @@ import { useDroppableTypesafe } from 'features/dnd/hooks/typesafeHooks';
import type { TypesafeDroppableData } from 'features/dnd/types';
import { isValidDrop } from 'features/dnd/util/isValidDrop';
import { AnimatePresence } from 'framer-motion';
import type { ReactNode } from 'react';
import { memo, useRef } from 'react';
import { v4 as uuidv4 } from 'uuid';
import IAIDropOverlay from './IAIDropOverlay';
type IAIDroppableProps = {
dropLabel?: ReactNode;
dropLabel?: string;
disabled?: boolean;
data?: TypesafeDroppableData;
};

View File

@@ -169,7 +169,7 @@ const GalleryBoard = ({ board, isSelected }: GalleryBoardProps) => {
{board.archived && !editingDisclosure.isOpen && <Icon as={PiArchiveBold} fill="base.300" />}
{!editingDisclosure.isOpen && <Text variant="subtext">{board.image_count}</Text>}
<IAIDroppable data={droppableData} dropLabel={<Text fontSize="lg">{t('unifiedCanvas.move')}</Text>} />
<IAIDroppable data={droppableData} dropLabel={t('unifiedCanvas.move')} />
</Flex>
</Tooltip>
)}

View File

@@ -92,7 +92,7 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
</Text>
{autoAddBoardId === 'none' && <AutoAddBadge />}
<Text variant="subtext">{imagesTotal}</Text>
<IAIDroppable data={droppableData} dropLabel={<Text fontSize="lg">{t('unifiedCanvas.move')}</Text>} />
<IAIDroppable data={droppableData} dropLabel={t('unifiedCanvas.move')} />
</Flex>
</Tooltip>
)}

View File

@@ -75,7 +75,6 @@ const ImageFieldInputComponent = (props: FieldComponentProps<ImageFieldInputInst
postUploadAction={postUploadAction}
useThumbailFallback
uploadElement={<UploadElement />}
dropLabel={<DropLabel />}
minSize={8}
>
<IAIDndImageIcon
@@ -100,14 +99,3 @@ const UploadElement = memo(() => {
});
UploadElement.displayName = 'UploadElement';
const DropLabel = memo(() => {
const { t } = useTranslation();
return (
<Text fontSize={16} fontWeight="semibold">
{t('gallery.drop')}
</Text>
);
});
DropLabel.displayName = 'DropLabel';