Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-component-link

Package Overview
Dependencies
Maintainers
11
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-component-link - npm Package Compare versions

Comparing version 4.0.1 to 4.2.0

dist/cf-component-link.js

12

lib/index.js
'use strict';
module.exports = require('./Link');
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Link = require('./Link');
var _Link2 = _interopRequireDefault(_Link);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Link2.default;

38

lib/Link.js
'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 _cfUtilRouteHandler = require('cf-util-route-handler');
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; }

@@ -13,8 +25,2 @@

var React = require('react');
var PropTypes = React.PropTypes;
var _require = require('cf-util-route-handler'),
routeTo = _require.routeTo;
var Link = function (_React$Component) {

@@ -52,3 +58,3 @@ _inherits(Link, _React$Component);

if (this.props.to) {
routeTo(this.props.to);
(0, _cfUtilRouteHandler.routeTo)(this.props.to);
} else {

@@ -100,3 +106,3 @@ this.props.onClick(e);

return React.createElement(tagName, props, children);
return _react2.default.createElement(tagName, props, children);
}

@@ -106,11 +112,11 @@ }]);

return Link;
}(React.Component);
}(_react2.default.Component);
Link.propTypes = {
to: PropTypes.string,
onClick: PropTypes.func,
tagName: PropTypes.string,
disabled: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.node
to: _react.PropTypes.string,
onClick: _react.PropTypes.func,
tagName: _react.PropTypes.string,
disabled: _react.PropTypes.bool,
className: _react.PropTypes.string,
children: _react.PropTypes.node
};

@@ -122,2 +128,2 @@

module.exports = Link;
exports.default = Link;
{
"name": "cf-component-link",
"description": "CloudFlare Link Component",
"version": "4.0.1",
"description": "Cloudflare Link Component",
"version": "4.2.0",
"main": "lib/index.js",
"module": "es/index.js",
"jsnext:main": "es/index.js",
"author": "James Kyle <jkyle@cloudflare.com>",

@@ -11,12 +13,8 @@ "license": "BSD-3-Clause",

},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0"
},
"dependencies": {
"cf-util-route-handler": "^4.0.1",
"react": "^0.14.2 || ^15.0.0-0"
},
"devDependencies": {
"assert-equal-jsx": "^1.0.0",
"backbone": "^1.2.3",
"jquery": "^2.2.0",
"react-dom": "^15.0.0-0"
"cf-util-route-handler": "^4.2.0"
}
}
# cf-component-link
> CloudFlare Link Component
> Cloudflare Link Component

@@ -13,12 +13,14 @@ ## Installation

```js
const React = require('react');
const Link = require('../../src/index');
```jsx
import React from 'react';
import Link from 'cf-component-link';
class Application extends React.Component {
class LinkComponent extends React.Component {
handleClick() {
console.log('handleClick!');
}
render() {
return (
<div>
<h1>CloudFlare Link Component Example</h1>
<p>Create a <code>Link</code> with a <code>to</code> prop:</p>

@@ -28,6 +30,8 @@ <Link to="/">Link to /</Link>

<p>Alternatively you can pass an <code>onClick</code> handler:</p>
<Link onClick={this.handleClick}>Link to something</Link>
<Link onClick={this.handleClick.bind(this)}>Link to something</Link>
<p>Note: This will give it a <code>role="button"</code></p>
<p>All additional props will be added to the <code>Link</code> element:</p>
<p>
All additional props will be added to the <code>Link</code> element:
</p>
<Link to="/foo" className="special-link">Link to /foo</Link>

@@ -37,5 +41,2 @@

<Link to="/bar" tagName="button">Link to /bar</Link>
<p>Or <code>disable</code> the link and it wont do anything when clicked:</p>
<Link to="/bar" disabled>Link to /bar</Link>
</div>

@@ -45,2 +46,4 @@ );

}
export default LinkComponent;
```

@@ -47,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc