All files / src/sections/PayBuilder/components/InvoicePreview PDFFromToSection.tsx

100% Statements 4/4
70% Branches 7/10
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      14x 3x     3x   3x                                                                            
import { View } from "@react-pdf/renderer";
import { MicroInformations } from "./PDFMicroInformations";
 
export const PDFFromToSection = ({ from, to }: { from: any; to: any }) => {
  const { name: fromMerchantName = "", address } = from;
 
  const toFullName =
    to?.firstName && to?.lastName && `${to?.firstName} ${to?.lastName}`.trim();
 
  return (
    <View
      id="from-to-section"
      style={{
        display: "flex",
        flexDirection: "row",
        justifyContent: "space-between",
      }}
      fixed
    >
      <View>
        <MicroInformations
          title="From"
          infos={[
            fromMerchantName,
            address?.line1,
            address?.country &&
              `${address?.country}, ${address?.city}, ${address?.zip}`,
          ]}
        />
      </View>
      {to && (
        <View>
          <MicroInformations
            title="Billed To"
            infos={[
              toFullName,
              to.email,
              to.address?.line1,
              to.address?.country &&
                `${to.address?.country}, ${to.address?.city}, ${to.address?.zip}`,
            ]}
          />
        </View>
      )}
    </View>
  );
};