UNPKG

@carbon/react

Version:

React components for the Carbon Design System

58 lines (53 loc) 1.61 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; var PropTypes = require('prop-types'); var React = require('react'); var index = require('../FeatureFlags/index.js'); var CSSGrid = require('./CSSGrid.js'); var FlexGrid = require('./FlexGrid.js'); function Grid(props) { const enableCSSGrid = index.useFeatureFlag('enable-css-grid'); if (enableCSSGrid) { return /*#__PURE__*/React.createElement(CSSGrid.CSSGrid, props); } return /*#__PURE__*/React.createElement(FlexGrid.FlexGrid, props); } Grid.propTypes = { /** * Specify grid alignment. Default is center */ align: PropTypes.oneOf(['start', 'center', 'end']), /** * 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; exports.Grid = GridAsGridComponent;