UNPKG

pouncejs

Version:

A collection of UI components from Panther labs

19 lines (18 loc) 573 B
import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; export var useItemSpacingProps = function useItemSpacingProps(spacing, direction, sx) { return React.useMemo(function () { if (!spacing) { return sx; } var isFlexColumn = direction && direction.includes('column'); return { sx: _extends({}, sx, { '& > *:not(:last-child)': { marginRight: isFlexColumn ? undefined : spacing, marginBottom: isFlexColumn ? spacing : undefined } }) }; }, [spacing, direction, sx]); };