@braineet/ui
Version:
Braineet design system
33 lines (32 loc) • 1.3 kB
JavaScript
var _excluded = ["children", "size", "color", "as"];
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 styles, { StyledLink } from './styles';
/**
The `Link` component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
var Link = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var children = _ref.children,
size = _ref.size,
color = _ref.color,
as = _ref.as,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var globalSize = ['small', 'medium', 'big'].includes(size) ? size : 'medium';
return /*#__PURE__*/_jsx(StyledLink, _extends({
ref: ref,
forwardedAs: as,
fontFamily: "display",
color: color,
size: styles.sizes[globalSize].text
}, restProps, {
children: children
}));
});
Link.defaultProps = {
size: 'medium',
as: 'a',
color: 'brand'
};
export default Link;