UNPKG

@vtex/styleguide

Version:

> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))

99 lines (75 loc) 4.32 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _config = require('vtex-tachyons/config.json'); var _config2 = _interopRequireDefault(_config); var _utils = require('../utils'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var iconBase = { width: 16, height: 16 }; var Link = function (_PureComponent) { _inherits(Link, _PureComponent); function Link() { _classCallCheck(this, Link); return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments)); } _createClass(Link, [{ key: 'render', value: function render() { var _props = this.props, color = _props.color, size = _props.size, block = _props.block; var newSize = (0, _utils.calcIconSize)(iconBase, size); return _react2.default.createElement( 'svg', { className: (0, _utils.baseClassname)('link') + ' ' + (block ? 'db' : ''), width: newSize.width, height: newSize.height, viewBox: '0 0 16 16', fill: 'none', xmlns: 'http://www.w3.org/2000/svg' }, _react2.default.createElement('path', { d: 'M5 0C3.7 0 2.4 0.5 1.5 1.5L0.3 2.6C-0.0999998 3 -0.0999998 3.6 0.3 4C0.7 4.4 1.3 4.4 1.7 4L2.9 2.8C4 1.7 6 1.7 7.1 2.8C7.7 3.4 8 4.2 8 5C8 5.8 7.7 6.6 7.1 7.1L6 8.3C5.6 8.7 5.6 9.3 6 9.7C6.2 9.9 6.5 10 6.7 10C6.9 10 7.2 9.9 7.4 9.7L8.6 8.5C9.5 7.6 10 6.3 10 5C10 3.7 9.5 2.4 8.5 1.5C7.6 0.5 6.3 0 5 0Z', transform: 'translate(6)', fill: color }), _react2.default.createElement('path', { d: 'M8.3 6L7.1 7.2C6 8.3 4 8.3 2.9 7.2C2.3 6.6 2 5.8 2 5C2 4.2 2.3 3.4 2.9 2.9L4 1.7C4.4 1.3 4.4 0.7 4 0.3C3.6 -0.0999998 3 -0.0999998 2.6 0.3L1.5 1.5C0.5 2.4 0 3.7 0 5C0 6.3 0.5 7.6 1.5 8.5C2.4 9.5 3.7 10 5 10C6.3 10 7.6 9.5 8.5 8.5L9.7 7.3C10.1 6.9 10.1 6.3 9.7 5.9C9.3 5.5 8.7 5.6 8.3 6Z', transform: 'translate(0 6)', fill: color }), _react2.default.createElement('path', { d: 'M4.5 0.3L0.3 4.5C-0.1 4.9 -0.1 5.5 0.3 5.9C0.5 6.1 0.8 6.2 1 6.2C1.2 6.2 1.5 6.1 1.7 5.9L5.9 1.7C6.3 1.3 6.3 0.7 5.9 0.3C5.5 -0.1 4.9 -0.1 4.5 0.3Z', transform: 'translate(4.8999 4.90002)', fill: color }) ); } }]); return Link; }(_react.PureComponent); Link.defaultProps = { color: _config2.default.colors['serious-black'], size: 16, block: false }; Link.propTypes = { color: _propTypes2.default.string, size: _propTypes2.default.number, block: _propTypes2.default.bool }; exports.default = Link;