Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

878 B
Raw Blame
import type { SystemStyleObject, TextProps } from '@invoke-ai/ui-library';
import { Text } from '@invoke-ai/ui-library';
import { linkifyOptions, linkifySx } from 'common/components/linkify';
import Linkify from 'linkify-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

const textSx: SystemStyleObject = {
  fontSize: 'md',
  whiteSpace: 'pre-wrap',
  overflowWrap: 'anywhere',
  '&[data-is-empty="true"]': {
    opacity: 0.3,
  },
  ...linkifySx,
};

export const TextElementContent = memo(({ content, ...rest }: { content: string } & TextProps) => {
  const { t } = useTranslation();
  return (
    <Text sx={textSx} data-is-empty={content === ''} {...rest}>
      <Linkify options={linkifyOptions}>{content || t('workflows.builder.textPlaceholder')}</Linkify>
    </Text>
  );
});

TextElementContent.displayName = 'TextElementContent';