cf-component-link
Advanced tools
Comparing version 4.0.1 to 4.2.0
'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; |
'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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23456
0
9
423
50
2
2
+ Addedreact@16.14.0(transitive)
- Removedreact@^0.14.2 || ^15.0.0-0
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedcf-util-route-handler@^4.2.0