@commercelayer/react-components
Version:
The Official Commerce Layer React Components
2 lines • 649 B
JavaScript
"use client";
import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import ParcelChildrenContext from"../../context/ParcelChildrenContext";import useCustomContext from"../../utils/hooks/useCustomContext";export function ParcelLineItemsCount({children,...p}){const{parcel}=useCustomContext({context:ParcelChildrenContext,contextComponentName:"Parcels",currentComponentName:"ParcelLineItemsCount",key:"parcel"}),quantity=parcel?.parcel_line_items?.length??0,childrenProps={...p,quantity,parcel};return children?_jsx(Parent,{...childrenProps,children}):_jsx("span",{...p,children:quantity})}export default ParcelLineItemsCount;