UNPKG

@i-novus/ui-core

Version:

Базовые UI компоненты

23 lines (22 loc) 986 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from 'react'; import classNames from 'classnames'; import { useConfigProvider } from '../../core'; import { useRowContext } from './Row'; export const Col = forwardRef((props, ref) => { const { className, prefix, span = 0, children } = props; const { getPrefix } = useConfigProvider(); const prefixCls = getPrefix(prefix); const rowContext = useRowContext(); if (rowContext) { const { gutter } = rowContext; return (_jsx("div", { ref: ref, className: classNames(`${prefixCls}-col`, { [`${prefixCls}-col-${span}`]: Number(span) || true, }, className), style: { paddingLeft: gutter && gutter / 2, paddingRight: gutter && gutter / 2, }, children: children })); } return (_jsx("div", { ref: ref, className: classNames(`${prefixCls}-col`, className), children: children })); }); Col.displayName = 'Col';