@braineet/ui
Version:
Braineet design system
39 lines (38 loc) • 1.73 kB
JavaScript
var _excluded = ["vertical", "color", "theme", "padding", "opacity"];
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); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import { withTheme } from 'styled-components';
import { DividerWrapper, StyledDivider } from './styles';
/**
* The `Divider` component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
export var Divider = function Divider(_ref) {
var vertical = _ref.vertical,
color = _ref.color,
theme = _ref.theme,
padding = _ref.padding,
opacity = _ref.opacity,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var width = props.width,
height = props.height;
return /*#__PURE__*/_jsx(DividerWrapper, {
padding: vertical ? '0 8px' : padding,
vertical: vertical,
children: /*#__PURE__*/_jsx(StyledDivider, _extends({
width: width || (vertical ? '2px' : '100%'),
height: height || (vertical ? '100%' : '2px'),
backgroundColor: color,
opacity: opacity
}, props))
});
};
Divider.defaultProps = {
padding: '8px 0',
vertical: false,
color: 'black',
theme: {},
opacity: 0.1
};
export default withTheme(Divider);