UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

47 lines (43 loc) 1.38 kB
/** * MSKCC 2021, 2024 */ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import cx from 'classnames'; import PropTypes from 'prop-types'; import React__default from 'react'; import { usePrefix } from '../../internal/usePrefix.js'; /** * Helper component for rendering content that hangs on the column. Useful when * trying to align content across different grid modes */ function ColumnHang(_ref) { let { as: BaseComponent = 'div', className: customClassName, children, ...rest } = _ref; const prefix = usePrefix(); const className = cx(customClassName, `${prefix}--grid-column-hang`); // cast as any to let TypeScript allow passing in attributes to base component const BaseComponentAsAny = BaseComponent; return /*#__PURE__*/React__default.createElement(BaseComponentAsAny, _extends({}, rest, { className: className }), children); } ColumnHang.propTypes = { /** * Provide a custom element to render instead of the default <div> */ as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]), /** * Pass in content that will be rendered within the `Grid` */ children: PropTypes.node, /** * Specify a custom className to be applied to the `Grid` */ className: PropTypes.string }; const ColumnHangComponent = ColumnHang; export { ColumnHangComponent as ColumnHang };