Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions dist/react-mailto.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

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; }
Expand All @@ -24,7 +28,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
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 toSearchString = exports.toSearchString = function toSearchString() {
var searchParams = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var searchParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

return Object.keys(searchParams).map(function (key) {
return key + '=' + encodeURIComponent(searchParams[key]);
Expand All @@ -45,7 +49,7 @@ var Mailto = function (_Component) {
function Mailto() {
_classCallCheck(this, Mailto);

return _possibleConstructorReturn(this, Object.getPrototypeOf(Mailto).apply(this, arguments));
return _possibleConstructorReturn(this, (Mailto.__proto__ || Object.getPrototypeOf(Mailto)).apply(this, arguments));
}

_createClass(Mailto, [{
Expand All @@ -56,13 +60,12 @@ var Mailto = function (_Component) {
}, {
key: 'renderLink',
value: function renderLink() {
var _props = this.props;
var email = _props.email;
var obfuscate = _props.obfuscate;
var headers = _props.headers;
var children = _props.children;

var others = _objectWithoutProperties(_props, ['email', 'obfuscate', 'headers', 'children']);
var _props = this.props,
email = _props.email,
obfuscate = _props.obfuscate,
headers = _props.headers,
children = _props.children,
others = _objectWithoutProperties(_props, ['email', 'obfuscate', 'headers', 'children']);

return _react2.default.createElement(
'a',
Expand All @@ -73,13 +76,12 @@ var Mailto = function (_Component) {
}, {
key: 'renderObfuscatedLink',
value: function renderObfuscatedLink() {
var _props2 = this.props;
var email = _props2.email;
var obfuscate = _props2.obfuscate;
var headers = _props2.headers;
var children = _props2.children;

var others = _objectWithoutProperties(_props2, ['email', 'obfuscate', 'headers', 'children']);
var _props2 = this.props,
email = _props2.email,
obfuscate = _props2.obfuscate,
headers = _props2.headers,
children = _props2.children,
others = _objectWithoutProperties(_props2, ['email', 'obfuscate', 'headers', 'children']);

return _react2.default.createElement(
'a',
Expand All @@ -91,9 +93,9 @@ var Mailto = function (_Component) {
key: 'handleClick',
value: function handleClick(event) {
event.preventDefault();
var _props3 = this.props;
var email = _props3.email;
var headers = _props3.headers;
var _props3 = this.props,
email = _props3.email,
headers = _props3.headers;

window.location.href = createMailtoLink(email, headers);
}
Expand All @@ -103,14 +105,14 @@ var Mailto = function (_Component) {
}(_react.Component);

Mailto.propTypes = {
children: _react.PropTypes.node.isRequired,
email: _react.PropTypes.string.isRequired,
headers: _react.PropTypes.object,
obfuscate: _react.PropTypes.bool
children: _propTypes2.default.node.isRequired,
email: _propTypes2.default.string.isRequired,
headers: _propTypes2.default.object,
obfuscate: _propTypes2.default.bool
};

Mailto.defaultProps = {
obfuscate: false
};

exports.default = Mailto;
exports.default = Mailto;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-mailto",
"description": "A react component to create and display a mailto link.",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/jasonbellamy/react-mailto",
"author": {
"name": "Jason Bellamy",
Expand Down Expand Up @@ -37,6 +37,7 @@
"chai": "^3.5.0",
"core-js": "^0.9.6",
"mocha": "^2.3.0",
"prop-types": "^15.5.4",
"react": "^15.2.1",
"react-addons-test-utils": "^15.2.1",
"react-shallow-output": "^0.2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/react-mailto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

export const toSearchString = (searchParams = {}) => {
return Object.keys(searchParams).map(key =>
Expand Down