Skip to content

Commit

Permalink
Use color for Button component instead of type (#150)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ikeyu0806 authored Jul 31, 2020
1 parent 81004ab commit df0ddb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import "./button.scss";
export const Button = ({
children,
onClick,
type,
color,
size,
disabled,
inverted,
inputType
type
}) => {
const classNames = ["button"];

if (type) {
classNames.push(`is-${type}`);
if (color) {
classNames.push(`is-${color}`);
}

if (size) {
Expand All @@ -27,7 +27,7 @@ export const Button = ({

return (
<button
type={inputType}
type={type}
disabled={disabled}
onClick={onClick}
className={classNames.join(" ")}
Expand All @@ -40,16 +40,16 @@ export const Button = ({
Button.propTypes = {
children: PropTypes.node.isRequired,
onClick: PropTypes.func,
type: PropTypes.oneOf(["primary", "danger", "warning"]),
color: PropTypes.oneOf(["primary", "danger", "warning"]),
size: PropTypes.oneOf(["small", "medium", "large"]),
disabled: PropTypes.bool,
inverted: PropTypes.bool,
inputType: PropTypes.oneOf(["button", "submit", "reset"])
type: PropTypes.oneOf(["button", "submit", "reset"])
};

Button.defaultProps = {
type: "primary",
color: "primary",
disabled: false,
inverted: false,
inputType: "button"
type: "button"
};
4 changes: 2 additions & 2 deletions src/components/button/button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function sayMyName() {

export const primary = () => {
return (
<Button type="primary" onClick={sayMyName}>
<Button color="primary" onClick={sayMyName}>
Hello Friend
</Button>
);
Expand Down Expand Up @@ -41,7 +41,7 @@ export const disabledAndInverted = () => {

export const danger = () => {
return (
<Button type="danger" onClick={sayMyName}>
<Button color="danger" onClick={sayMyName}>
Hello Friend
</Button>
);
Expand Down

1 comment on commit df0ddb0

@vercel
Copy link

@vercel vercel bot commented on df0ddb0 Jul 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.