@gechiui/components
Version:
UI components for GeChiUI.
51 lines (45 loc) • 1.29 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { createElement } from "@gechiui/element";
/**
* Internal dependencies
*/
import { contextConnect } from '../../ui/context';
import { Scrollable } from '../../scrollable';
import { View } from '../../view';
import { useCardBody } from './hook';
/**
* @param {import('../../ui/context').GeChiUIComponentProps<import('../types').BodyProps, 'div'>} props
* @param {import('react').Ref<any>} forwardedRef
*/
function CardBody(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.
*
* @example
* ```jsx
* import { Card, CardBody } from `@gechiui/components`;
*
* <Card>
* <CardBody>
* ...
* </CardBody>
* </Card>
* ```
*/
const ConnectedCardBody = contextConnect(CardBody, 'CardBody');
export default ConnectedCardBody;
//# sourceMappingURL=component.js.map