Skip to content

Commit df0ddb0

Browse files
authored
Use color for Button component instead of type (#150)
* Use color for Button component instead of type * rename `inputType` prop to `type`(#149) * rename `inputType` prop to `type` * update version to 2.0.0 * update version to 2.0.0
1 parent 81004ab commit df0ddb0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/components/button/button.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import "./button.scss";
55
export const Button = ({
66
children,
77
onClick,
8-
type,
8+
color,
99
size,
1010
disabled,
1111
inverted,
12-
inputType
12+
type
1313
}) => {
1414
const classNames = ["button"];
1515

16-
if (type) {
17-
classNames.push(`is-${type}`);
16+
if (color) {
17+
classNames.push(`is-${color}`);
1818
}
1919

2020
if (size) {
@@ -27,7 +27,7 @@ export const Button = ({
2727

2828
return (
2929
<button
30-
type={inputType}
30+
type={type}
3131
disabled={disabled}
3232
onClick={onClick}
3333
className={classNames.join(" ")}
@@ -40,16 +40,16 @@ export const Button = ({
4040
Button.propTypes = {
4141
children: PropTypes.node.isRequired,
4242
onClick: PropTypes.func,
43-
type: PropTypes.oneOf(["primary", "danger", "warning"]),
43+
color: PropTypes.oneOf(["primary", "danger", "warning"]),
4444
size: PropTypes.oneOf(["small", "medium", "large"]),
4545
disabled: PropTypes.bool,
4646
inverted: PropTypes.bool,
47-
inputType: PropTypes.oneOf(["button", "submit", "reset"])
47+
type: PropTypes.oneOf(["button", "submit", "reset"])
4848
};
4949

5050
Button.defaultProps = {
51-
type: "primary",
51+
color: "primary",
5252
disabled: false,
5353
inverted: false,
54-
inputType: "button"
54+
type: "button"
5555
};

src/components/button/button.stories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function sayMyName() {
99

1010
export const primary = () => {
1111
return (
12-
<Button type="primary" onClick={sayMyName}>
12+
<Button color="primary" onClick={sayMyName}>
1313
Hello Friend
1414
</Button>
1515
);
@@ -41,7 +41,7 @@ export const disabledAndInverted = () => {
4141

4242
export const danger = () => {
4343
return (
44-
<Button type="danger" onClick={sayMyName}>
44+
<Button color="danger" onClick={sayMyName}>
4545
Hello Friend
4646
</Button>
4747
);

0 commit comments

Comments
 (0)