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 { IconButton, Tooltip } from '@invoke-ai/ui-library';
import { GradientToolIcon } from 'features/controlLayers/components/Tool/GradientIcons';
import { useSelectTool, useToolIsSelected } from 'features/controlLayers/components/Tool/hooks';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';

export const ToolGradientButton = memo(() => {
  const { t } = useTranslation();
  const isSelected = useToolIsSelected('gradient');
  const selectGradient = useSelectTool('gradient');
  // clicking selects the gradient tool; mode switching is handled in the top toolbar
  const handleClick = useCallback(() => selectGradient(), [selectGradient]);

  const gradientLabel = t('controlLayers.tool.gradient');

  return (
    <Tooltip label={gradientLabel} placement="end">
      <IconButton
        aria-label={gradientLabel}
        icon={<GradientToolIcon />}
        isActive={isSelected}
        colorScheme={isSelected ? 'invokeBlue' : 'base'}
        variant="solid"
        onClick={handleClick}
      />
    </Tooltip>
  );
});

ToolGradientButton.displayName = 'ToolGradientButton';