UNPKG

@commercelayer/react-components

Version:
2 lines 617 B
"use client"; import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import ShipmentContext from"../../context/ShipmentContext";import useCustomContext from"../../utils/hooks/useCustomContext";export function ShipmentsCount({children,...p}){const{shipments}=useCustomContext({context:ShipmentContext,contextComponentName:"ShipmentsContainer",currentComponentName:"ShipmentsCount",key:"shipments"}),quantity=shipments?.length??0,childrenProps={...p,quantity,shipments};return children?_jsx(Parent,{...childrenProps,children}):_jsx("span",{...p,children:quantity})}export default ShipmentsCount;