baseui
Version:
A React Component library implementing the Base design language
44 lines (42 loc) • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Cell;
var _react = _interopRequireDefault(require("react"));
var _overrides = require("../helpers/overrides");
var _styledComponents = require("./styled-components");
var _grid = require("./grid");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
function Cell({
align,
children,
gridColumns,
gridGaps,
gridGutters,
gridUnit,
order,
skip,
span,
overrides = {}
}) {
const [StyledCell, overrideProps] = (0, _overrides.getOverrides)(overrides.Cell, _styledComponents.StyledCell);
const gridContext = _react.default.useContext(_grid.GridContext);
return /*#__PURE__*/_react.default.createElement(StyledCell, _extends({
$align: align
// TODO(v11): Remove the four grid props, get them solely from GridContext
,
$gridColumns: gridColumns || gridContext.gridColumns,
$gridGaps: gridGaps || gridContext.gridGaps,
$gridGutters: gridGutters || gridContext.gridGutters,
$gridUnit: gridUnit || gridContext.gridUnit,
$order: order,
$skip: skip,
$span: span
}, overrideProps), children);
}