All files / src/components/Merchants/MerchantPreview/modals/shared GiveBusinessOwnersNavigation.tsx

100% Statements 4/4
0% Branches 0/3
100% Functions 1/1
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                          4x             5x 5x   5x                                                        
import { Stack } from "@mui/material";
import { ArrowLeftIcon, ArrowRightIcon } from "@phosphor-icons/react";
import GiveText from "@shared/Text/GiveText";
import GiveIconButton from "@shared/IconButton/GiveIconButton";
 
interface GiveBusinessOwnersNavigationProps {
  currentIndex?: number;
  totalCount?: number;
  onPrevious?: () => void;
  onNext?: () => void;
  testIdPrefix?: string;
}
 
const GiveBusinessOwnersNavigation = ({
  currentIndex = 0,
  totalCount = 0,
  onPrevious,
  onNext,
  testIdPrefix = "bo-nav",
}: GiveBusinessOwnersNavigationProps) => {
  const isPrevDisabled = currentIndex === 0;
  const isNextDisabled = currentIndex === totalCount - 1;
 
  return (
    <Stack direction="row" alignItems="center" justifyContent="space-between">
      <GiveText variant="bodyS" color="secondary">
        {currentIndex + 1} of {totalCount}
      </GiveText>
      <Stack direction="row" spacing={1}>
        <GiveIconButton
          Icon={ArrowLeftIcon}
          size="small"
          variant="ghost"
          disabled={isPrevDisabled}
          onClick={onPrevious}
          data-testid={`${testIdPrefix}-prev`}
        />
        <GiveIconButton
          Icon={ArrowRightIcon}
          size="small"
          variant="ghost"
          disabled={isNextDisabled}
          onClick={onNext}
          data-testid={`${testIdPrefix}-next`}
        />
      </Stack>
    </Stack>
  );
};
 
export default GiveBusinessOwnersNavigation;