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.

1.6 KB
Raw Blame
import type { ElementType, ReactNode, Ref } from 'react';

import { Badge, Flex, HStack, Icon, Stack, Text } from '@chakra-ui/react';

export interface KeyStatusBadge {
  label: string;
  palette: string;
}

export const KeyCardShell = ({
  children,
  description,
  icon,
  isHighlighted = false,
  ref,
  status,
  title,
}: {
  children: ReactNode;
  description: string;
  icon: ElementType;
  isHighlighted?: boolean;
  ref?: Ref<HTMLDivElement>;
  status: KeyStatusBadge | null;
  title: string;
}) => (
  <Stack
    ref={ref}
    bg="bg.subtle"
    borderColor={isHighlighted ? 'border.emphasized' : 'border.subtle'}
    borderWidth="1px"
    gap="2.5"
    p="3"
    rounded="lg"
    transition="border-color var(--wb-motion-duration-fast) ease"
  >
    <HStack align="start" gap="2.5">
      <Flex
        align="center"
        bg="bg.emphasized"
        borderColor="border.subtle"
        borderWidth="1px"
        boxSize="8"
        color="fg.muted"
        flexShrink={0}
        justify="center"
        rounded="md"
      >
        <Icon as={icon} boxSize="4" />
      </Flex>
      <Stack flex="1" gap="0" minW="0">
        <HStack gap="1.5">
          <Text fontSize="md" fontWeight="700" truncate>
            {title}
          </Text>
          {status ? (
            <Badge colorPalette={status.palette} flexShrink={0} fontSize="xs" size="lg" variant="surface">
              {status.label}
            </Badge>
          ) : null}
        </HStack>
        <Text color="fg.subtle" fontSize="xs" lineClamp={2}>
          {description}
        </Text>
      </Stack>
    </HStack>
    {children}
  </Stack>
);