@wordpress/components
Version:
UI components for WordPress.
50 lines (43 loc) • 1.11 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
/**
* Internal dependencies
*/
import { contextConnect } from '../../ui/context';
import { Scrollable } from '../../scrollable';
import { View } from '../../view';
import { useCardBody } from './hook';
function UnconnectedCardBody(props, forwardedRef) {
const {
isScrollable,
...otherProps
} = useCardBody(props);
if (isScrollable) {
return createElement(Scrollable, _extends({}, otherProps, {
ref: forwardedRef
}));
}
return createElement(View, _extends({}, otherProps, {
ref: forwardedRef
}));
}
/**
* `CardBody` renders an optional content area for a `Card`.
* Multiple `CardBody` components can be used within `Card` if needed.
*
* ```jsx
* import { Card, CardBody } from `@wordpress/components`;
*
* <Card>
* <CardBody>
* ...
* </CardBody>
* </Card>
* ```
*/
export const CardBody = contextConnect(UnconnectedCardBody, 'CardBody');
export default CardBody;
//# sourceMappingURL=component.js.map