(Context);
const clsPrefix = `${prefix}p`;
const isCustomSize =
isNumber(spacingProp) ||
(isString(spacingProp) && spacingProp !== '' && !isPresetSize(spacingProp));
const spacing = isCustomSize ? 'medium' : spacingProp;
const newStyle = useMemo(
() => ({
marginTop: wrapUnit(beforeMargin) || 0,
marginBottom: wrapUnit(afterMargin) || 0,
// 如果 spacingProp 为数值类型,则默认修改当前段落下的间隙值
...(isCustomSize
? {
'--page-p-medium-spacing': wrapUnit(spacingProp),
}
: null),
...style,
}),
[beforeMargin, afterMargin, isCustomSize, style],
);
return (
{getChildren(children, type)}
);
};
const RefParagraph: IParagraph = forwardRef(P);
RefParagraph.displayName = 'P';
RefParagraph.typeMark = 'P';
RefParagraph.defaultProps = {
spacing: 'medium',
hasVerSpacing: true,
verAlign: 'middle',
};
export default RefParagraph;