diff --git a/.eslintrc b/.eslintrc index 111f80aef4..c9aabdaa8b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,8 +2,11 @@ "extends": "airbnb", "rules": { "indent": [2, 4, { "SwitchCase": 1 }], - "react/jsx-indent": [2, 4], - "react/jsx-indent-props": [2, 4] + "react/jsx-indent": 0, + "react/jsx-indent-props": [2, 4], + "react/wrap-multilines": 0, + "eol-last": 0, + "comma-dangle": 0 }, "env": { "mocha": true diff --git a/CHANGELOG.md b/CHANGELOG.md index 84d3bf98e5..061070acdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2.3.0 + +* Buttons now accepts inline styles as a `style` prop + ## v2.2.0 * Added tertiary button diff --git a/README.md b/README.md index 8104215040..43ef0dd0ad 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,11 @@ to disable a button, you can do this as well by setting the `disableButton` prop ``` This works for all button types, but make sure you have a really good reason for using it! + +### Styling + +Any style attributes given to a button component will be passed on to the underlying html button element. + +```javascript + +``` diff --git a/package.json b/package.json index 494f01c5d4..90c28478da 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "ffe-button-react", - "version": "2.2.0", + "version": "2.3.0", "description": "React implementation of ffe-button", "main": "lib/index.js", "scripts": { "build": "babel -d lib/. --ignore=*.test.js src/.", "lint": "eslint src/.", "test:nsp": "nsp check", - "test:spec": "mocha --require babel-register --reporter mocha-tap13 src/**/*.test.js", + "test:spec": "mocha --require babel-register src/**/*.test.js", + "tdd": "mocha --require babel-register src/**/*.test.js -w", "test": "npm run test:spec && npm run test:nsp", "prepublish": "npm run build", "has-published": "npm show . versions -s | grep -q ${npm_package_version}" diff --git a/src/ActionButton.js b/src/ActionButton.js index 2d44e78cfe..577547c013 100644 --- a/src/ActionButton.js +++ b/src/ActionButton.js @@ -2,43 +2,12 @@ import React, { PropTypes } from 'react'; import Button from './Button'; export default function ActionButton(props) { - const { - action, - ariaLoadingMessage, - children, - disableButton, - id, - isLoading, - label, - onClick, - isTabbable, - } = props; - - return ( - - ); + return ; } + ActionButton.propTypes = { - action: PropTypes.string, - ariaLoadingMessage: PropTypes.string, - children: PropTypes.node, - disableButton: PropTypes.bool, - id: PropTypes.string, - isLoading: PropTypes.bool, - label: PropTypes.string, - onClick: PropTypes.func.isRequired, - isTabbable: PropTypes.bool, -}; + children: PropTypes.node +}; \ No newline at end of file diff --git a/src/Button.js b/src/Button.js index c5a98942b5..760ea22fb5 100644 --- a/src/Button.js +++ b/src/Button.js @@ -12,9 +12,11 @@ export default function Button(props) { onClick, type = 'primary', simpleContent = false, + style = {}, isTabbable, } = props; const tabIndex = isTabbable ? 0 : -1; + return ( - ); + return ; } PrimaryButton.propTypes = { - action: PropTypes.string, - ariaLoadingMessage: PropTypes.string, - children: PropTypes.node, - disableButton: PropTypes.bool, - id: PropTypes.string, - isLoading: PropTypes.bool, - label: PropTypes.string, - onClick: PropTypes.func.isRequired, - isTabbable: PropTypes.bool, -}; + children: PropTypes.node +}; \ No newline at end of file diff --git a/src/SecondaryButton.js b/src/SecondaryButton.js index b9289d6b3f..18a108d459 100644 --- a/src/SecondaryButton.js +++ b/src/SecondaryButton.js @@ -2,43 +2,12 @@ import React, { PropTypes } from 'react'; import Button from './Button'; export default function SecondaryButton(props) { - const { - action, - ariaLoadingMessage, - children, - disableButton, - id, - isLoading, - label, - onClick, - isTabbable, - } = props; - - return ( - - ); + return ; } + SecondaryButton.propTypes = { - action: PropTypes.string, - ariaLoadingMessage: PropTypes.string, - children: PropTypes.node, - disableButton: PropTypes.bool, - id: PropTypes.string, - isLoading: PropTypes.bool, - label: PropTypes.string, - onClick: PropTypes.func.isRequired, - isTabbable: PropTypes.bool, -}; + children: PropTypes.node +}; \ No newline at end of file diff --git a/src/ShortcutButton.js b/src/ShortcutButton.js index e805a56cca..44e63f5d33 100644 --- a/src/ShortcutButton.js +++ b/src/ShortcutButton.js @@ -2,43 +2,11 @@ import React, { PropTypes } from 'react'; import Button from './Button'; export default function ShortcutButton(props) { - const { - action, - ariaLoadingMessage, - children, - disableButton, - id, - isLoading, - label, - onClick, - isTabbable, - } = props; - - return ( - - ); + return ; } ShortcutButton.propTypes = { - action: PropTypes.string, - ariaLoadingMessage: PropTypes.string, - children: PropTypes.node, - disableButton: PropTypes.bool, - id: PropTypes.string, - isLoading: PropTypes.bool, - label: PropTypes.string, - onClick: PropTypes.func.isRequired, - isTabbable: PropTypes.bool, -}; + children: PropTypes.node +}; \ No newline at end of file diff --git a/src/TertiaryButton.js b/src/TertiaryButton.js index 9ac0f857ad..9177524d6e 100644 --- a/src/TertiaryButton.js +++ b/src/TertiaryButton.js @@ -2,29 +2,9 @@ import React, { PropTypes } from 'react'; import Button from './Button'; export default function TertiaryButton(props) { - const { - action, - children, - disableButton, - id, - label, - onClick, - isTabbable = true, - } = props; - return ( - - ); + return ; } TertiaryButton.propTypes = {