feat(toolbox): add ability to run a handler after click to AbstractButton
This commit is contained in:
parent
f608ad4e5e
commit
99b5a41269
|
@ -7,6 +7,11 @@ import ToolboxItem from './ToolboxItem';
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to be called after the click handler has been processed.
|
||||||
|
*/
|
||||||
|
afterClick: ?Function,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to show the label or not.
|
* Whether to show the label or not.
|
||||||
*/
|
*/
|
||||||
|
@ -38,6 +43,7 @@ export type Props = {
|
||||||
*/
|
*/
|
||||||
export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
afterClick: undefined,
|
||||||
showLabel: false,
|
showLabel: false,
|
||||||
styles: undefined,
|
styles: undefined,
|
||||||
toggledStyles: undefined,
|
toggledStyles: undefined,
|
||||||
|
@ -165,7 +171,10 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_onClick() {
|
_onClick() {
|
||||||
|
const { afterClick } = this.props;
|
||||||
|
|
||||||
this._handleClick();
|
this._handleClick();
|
||||||
|
afterClick && afterClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue