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.1 KB
Raw Blame
import type { IconButtonProps, SystemStyleObject } from '@invoke-ai/ui-library';
import { IconButton } from '@invoke-ai/ui-library';
import type { MouseEvent } from 'react';
import { memo } from 'react';

const imageButtonSx: SystemStyleObject = {
  minW: 0,
  svg: {
    transitionProperty: 'common',
    transitionDuration: 'normal',
    fill: 'base.100',
    _hover: { fill: 'base.50' },
    filter: `drop-shadow(0px 0px 0.1rem var(--invoke-colors-base-900))
      drop-shadow(0px 0px 0.3rem var(--invoke-colors-base-900))
      drop-shadow(0px 0px 0.3rem var(--invoke-colors-base-900))`,
  },
};

type Props = Omit<IconButtonProps, 'aria-label' | 'onClick' | 'tooltip'> & {
  onClick: (event: MouseEvent<HTMLButtonElement>) => void;
  tooltip: string;
};

export const DndImageIcon = memo((props: Props) => {
  const { onClick, tooltip, icon, ...rest } = props;

  return (
    <IconButton
      onClick={onClick}
      tooltip={tooltip}
      aria-label={tooltip}
      icon={icon}
      variant="link"
      sx={imageButtonSx}
      data-testid={tooltip}
      {...rest}
    />
  );
});

DndImageIcon.displayName = 'DndImageIcon';