Skip to content

Commit

Permalink
Add disabled property for widget button
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed May 21, 2017
1 parent f31f488 commit da05440
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/web/components/Widget/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import classNames from 'classnames';
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import Anchor from '../Anchor';
import styles from './index.styl';

class Button extends Component {
static propTypes = {
onClick: PropTypes.func
...Anchor.propTypes
};
static defaultProps = {
onClick: () => {}
...Anchor.defaultProps
};

render() {
const { onClick, className, ...props } = this.props;
const { className, ...props } = this.props;

return (
<Anchor
{...props}
className={classNames(className, styles.widgetButton)}
onClick={onClick}
className={classNames(
className,
styles.widgetButton,
{ [styles.disabled]: !!props.disabled }
)}
/>
);
}
Expand Down
8 changes: 8 additions & 0 deletions src/web/components/Widget/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@
margin: 0;
text-align: center;

&.disabled {
color: #bbb;
cursor: not-allowed;
}

&.disabled:hover {
background-color: inherit;
}
&:hover {
background-color: rgba(0, 0, 0, .05);
}
Expand Down

0 comments on commit da05440

Please sign in to comment.