@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
49 lines (45 loc) • 1.41 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import PropTypes from 'prop-types';
import React__default from 'react';
import { useFeatureFlag } from '../FeatureFlags/index.js';
import { CSSGrid as CSSGridComponent } from './CSSGrid.js';
import { FlexGrid as FlexGridComponent } from './FlexGrid.js';
function Grid(props) {
const enableCSSGrid = useFeatureFlag('enable-css-grid');
if (enableCSSGrid) {
return /*#__PURE__*/React__default.createElement(CSSGridComponent, props);
}
return /*#__PURE__*/React__default.createElement(FlexGridComponent, props);
}
Grid.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,
/**
* Collapse the gutter to 1px. Useful for fluid layouts.
* Rows have 1px of margin between them to match gutter.
*/
condensed: PropTypes.bool,
/**
* Remove the default max width that the grid has set
*/
fullWidth: PropTypes.bool,
/**
* Container hangs 16px into the gutter. Useful for
* typographic alignment with and without containers.
*/
narrow: PropTypes.bool
};
const GridAsGridComponent = Grid;
export { GridAsGridComponent as Grid };