All files / src/features/Merchants/MerchantSidePanel/components ValueWithEdit.tsx

100% Statements 1/1
100% Branches 2/2
100% Functions 1/1
100% Lines 1/1

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                                22x                                        
import { Stack } from "@mui/material";
import { PencilSimpleIcon } from "@phosphor-icons/react";
import GiveIconButton from "@shared/IconButton/GiveIconButton";
import GiveText from "@shared/Text/GiveText";
 
export default function ValueWithEdit({
  text,
  onEdit,
  testId,
  readOnly,
}: {
  text: string;
  onEdit: () => void;
  testId?: string;
  readOnly?: boolean;
}) {
  return (
    <Stack
      direction="row"
      justifyContent="space-between"
      alignItems="center"
      height="20px"
    >
      <GiveText variant="bodyS">{text}</GiveText>
      {!readOnly && (
        <GiveIconButton
          Icon={PencilSimpleIcon}
          variant="ghost"
          size="small"
          onClick={onEdit}
          data-testid={testId}
        />
      )}
    </Stack>
  );
}