All files / src/sections/PayBuilder/Forms/About/components CropButtons.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 3/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72                                                  13x 13x                           2x                                     2x                        
import { Stack } from "@mui/material";
import { MinusIcon, PlusIcon } from "@phosphor-icons/react";
import GiveIconButton from "@shared/IconButton/GiveIconButton";
import { CustomSlider } from "@shared/ProfileImage/EditProfileImageModal/components/Editor/ImageEditorToolbar";
import React from "react";
import GiveText from "@shared/Text/GiveText";
import { useAppTheme } from "@theme/v2/Provider";
import {
  MIN_ZOOM,
  MAX_ZOOM,
} from "@sections/PayBuilder/Forms/About/ImageModalNew";
 
function CropButtons({
  isMinZoom,
  handleZoom,
  zoomValue,
  handleUpdateSlider,
  isMaxZoom,
}: {
  isMinZoom: boolean;
  handleZoom: (state?: boolean) => void;
  zoomValue: number;
  handleUpdateSlider: (event: Event, zoom: number | number[]) => void;
  isMaxZoom: boolean;
}) {
  const { palette } = useAppTheme();
  return (
    <Stack
      zIndex={1}
      gap="8px"
      alignItems="center"
      flexDirection="row"
      flex={4}
    >
      <GiveIconButton
        data-testid="crop-zoom-minus"
        Icon={MinusIcon}
        color={palette.icon?.["icon-primary"]}
        size="small"
        variant="ghost"
        onClick={() => handleZoom()}
        disabled={isMinZoom}
      />
 
      <CustomSlider
        value={zoomValue}
        min={MIN_ZOOM}
        max={MAX_ZOOM}
        step={0.1}
        aria-label="Zoom"
        onChange={handleUpdateSlider}
      />
      <Stack gap="8px" alignItems="center" flexDirection="row">
        <GiveIconButton
          data-testid="crop-zoom-plus"
          Icon={PlusIcon}
          color={palette.icon?.["icon-primary"]}
          size="small"
          variant="ghost"
          onClick={() => handleZoom(true)}
          disabled={isMaxZoom}
        />
        <GiveText fontWeight={400} color="secondary" fontSize="12px">
          {Math.floor((zoomValue / MAX_ZOOM) * 100)}%
        </GiveText>
      </Stack>
    </Stack>
  );
}
 
export default CropButtons;