UNPKG

@jorgeblacio/react-custom-share

Version:
57 lines (35 loc) 4.66 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || 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; }; var _templateObject = _taggedTemplateLiteral(['\n align-items: center;\n border: 0;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n height: 44px;\n justify-content: center;\n margin: 3px;\n position: relative;\n transition: 0.3s;\n width: 44px;\n\n &::before {\n background-color: rgba(255, 255, 255, 0.2);\n border-bottom-left-radius: 100px;\n border-top-left-radius: 100px;\n color: inherit;\n content: \'\';\n height: 100%;\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-100%, -50%);\n transition: 0.2s;\n width: 50%;\n }\n\n & > svg {\n fill: #fff;\n height: auto;\n transform: scale(1);\n transition: 0.3s;\n width: 22px;\n z-index: 1;\n }\n\n &:hover {\n &::before {\n background-color: rgba(0, 0, 0, 0.1);\n transform: translate(0%, -50%) rotateY(180deg);\n }\n\n & > svg {\n transform: scale(1.2);\n }\n }\n\n @media (any-hover: none) {\n &:hover {\n &::before {\n background-color: rgba(255, 255, 255, 0.2);\n transform: translate(-100%, -50%);\n }\n\n & > svg {\n transform: scale(1);\n }\n }\n }\n\n @media (min-width: 330px) {\n margin: 5px;\n }\n\n @media (min-width: 600px) {\n margin: 7px;\n }\n\n @media (min-width: 1025px) {\n margin: 10px;\n }\n'], ['\n align-items: center;\n border: 0;\n border-radius: 50%;\n cursor: pointer;\n display: flex;\n height: 44px;\n justify-content: center;\n margin: 3px;\n position: relative;\n transition: 0.3s;\n width: 44px;\n\n &::before {\n background-color: rgba(255, 255, 255, 0.2);\n border-bottom-left-radius: 100px;\n border-top-left-radius: 100px;\n color: inherit;\n content: \'\';\n height: 100%;\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-100%, -50%);\n transition: 0.2s;\n width: 50%;\n }\n\n & > svg {\n fill: #fff;\n height: auto;\n transform: scale(1);\n transition: 0.3s;\n width: 22px;\n z-index: 1;\n }\n\n &:hover {\n &::before {\n background-color: rgba(0, 0, 0, 0.1);\n transform: translate(0%, -50%) rotateY(180deg);\n }\n\n & > svg {\n transform: scale(1.2);\n }\n }\n\n @media (any-hover: none) {\n &:hover {\n &::before {\n background-color: rgba(255, 255, 255, 0.2);\n transform: translate(-100%, -50%);\n }\n\n & > svg {\n transform: scale(1);\n }\n }\n }\n\n @media (min-width: 330px) {\n margin: 5px;\n }\n\n @media (min-width: 600px) {\n margin: 7px;\n }\n\n @media (min-width: 1025px) {\n margin: 10px;\n }\n']), _templateObject2 = _taggedTemplateLiteral(['\n background: ', ';\n'], ['\n background: ', ';\n']); var _emotion = require('emotion'); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _colors = require('./colors'); var _colors2 = _interopRequireDefault(_colors); var _ShareButton = require('../ShareButton'); var _ShareButton2 = _interopRequireDefault(_ShareButton); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var styles = (0, _emotion.css)(_templateObject); var dynamicStyles = function dynamicStyles(props) { return (0, _emotion.css)(_templateObject2, _colors2.default[props.network]); }; var ShareButtonCircle = function ShareButtonCircle(props) { var className = props.className, rest = _objectWithoutProperties(props, ['className']); var dynamicStylesStr = dynamicStyles(props); return _react2.default.createElement(_ShareButton2.default, _extends({ className: (0, _emotion.cx)(styles, dynamicStylesStr, className) }, rest)); }; ShareButtonCircle.propTypes = { className: _propTypes2.default.any }; exports.default = ShareButtonCircle;