@braineet/ui
Version:
Braineet design system
33 lines (32 loc) • 1.47 kB
JavaScript
var _excluded = ["children", "size", "color", "as"];
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 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;