@canonical/react-components
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -36,6 +36,10 @@ "use strict"; | ||
"has-icon": hasIcon, | ||
"is-disabled": Component === "a" & disabled, | ||
"is-disabled": Component !== "button" & disabled, | ||
"is-inline": inline | ||
}); | ||
var onClickDisabled = function onClickDisabled(e) { | ||
return e.preventDefault(); | ||
}; | ||
if (Component === "button") { | ||
@@ -45,3 +49,5 @@ return _react.default.createElement("button", _extends({ | ||
disabled: disabled | ||
}, props), children); | ||
}, props, { | ||
onClick: disabled ? onClickDisabled : undefined | ||
}), children); | ||
} | ||
@@ -52,3 +58,5 @@ | ||
"aria-disabled": disabled | ||
}, props), children); | ||
}, props, { | ||
onClick: disabled ? onClickDisabled : undefined | ||
}), children); | ||
}; | ||
@@ -55,0 +63,0 @@ |
@@ -21,2 +21,3 @@ "use strict"; | ||
expect(wrapper).toMatchSnapshot(); | ||
expect(wrapper.prop("onClick")).toBe(undefined); | ||
}); | ||
@@ -39,2 +40,3 @@ it("correctly disables a button", function () { | ||
expect(wrapper.prop("disabled")).toBe(undefined); | ||
expect(wrapper.prop("onClick")).not.toBe(undefined); | ||
}); | ||
@@ -41,0 +43,0 @@ it("correctly handle icons", function () { |
{ | ||
"name": "@canonical/react-components", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "module": "dist/index.js", | ||
}, | ||
"homepage": "https://github.com/canonical-web-and-design/react-components/", | ||
"homepage": "/react-components/", | ||
"devDependencies": { | ||
@@ -38,3 +38,3 @@ "@babel/cli": "7.6.4", | ||
}, | ||
"peerDependencies.": { | ||
"peerDependencies": { | ||
"react": "16.11.0", | ||
@@ -45,3 +45,3 @@ "react-dom": "16.11.0" | ||
"build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files --ignore .test.js,.md,__snapshots__,testing", | ||
"build-docs": "build-storybook -c .storybook -o .out", | ||
"build-docs": "build-storybook -c .storybook -o docs", | ||
"clean": "rm -rf node_modules dist .out", | ||
@@ -48,0 +48,0 @@ "docs": "start-storybook --port 8403", |
This package provides [React](https://reactjs.org/) components for [Vanilla Framework](http://vanillaframework.io). | ||
See the [component docs](https://canonical-web-and-design.github.io/react-components/) for usage instructions. | ||
## Install | ||
@@ -4,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
254909
151
3908
24
5