@braineet/ui
Version:
Braineet design system
39 lines (38 loc) • 1.56 kB
JavaScript
var _excluded = ["vertical", "color", "theme", "padding", "opacity"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
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);