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.

897 B
Raw Blame
import type { HeadingProps, SystemStyleObject } 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 headingSx: SystemStyleObject = {
  fontWeight: 'bold',
  fontSize: '2xl',
  whiteSpace: 'pre-wrap',
  '&[data-is-empty="true"]': {
    opacity: 0.3,
  },
  ...linkifySx,
};

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

HeadingElementContent.displayName = 'HeadingElementContent';