UNPKG

1.48 kBJavaScriptView Raw
1import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2import { jsx as _jsx } from "react/jsx-runtime";
3import { ConfigProvider } from 'antd';
4import classNames from 'classnames';
5import { useContext } from 'react';
6import { RouteContext } from '../../context/RouteContext';
7import { useStyle } from './style';
8/**
9 * This component can support contentWidth so you don't need to calculate the width
10 * contentWidth=Fixed, width will is 1200
11 *
12 * @param props
13 */
14var GridContent = function GridContent(props) {
15 var value = useContext(RouteContext);
16 var children = props.children,
17 propsContentWidth = props.contentWidth,
18 propsClassName = props.className,
19 style = props.style;
20 var _useContext = useContext(ConfigProvider.ConfigContext),
21 getPrefixCls = _useContext.getPrefixCls;
22 var prefixCls = props.prefixCls || getPrefixCls('pro');
23 var contentWidth = propsContentWidth || value.contentWidth;
24 var className = "".concat(prefixCls, "-grid-content");
25 var _useStyle = useStyle(className),
26 wrapSSR = _useStyle.wrapSSR,
27 hashId = _useStyle.hashId;
28 var isWide = contentWidth === 'Fixed';
29 return wrapSSR(_jsx("div", {
30 className: classNames(className, hashId, propsClassName, _defineProperty({}, "".concat(className, "-wide"), isWide)),
31 style: style,
32 children: _jsx("div", {
33 className: "".concat(prefixCls, "-grid-content-children ").concat(hashId),
34 children: children
35 })
36 }));
37};
38export { GridContent };
\No newline at end of file