saleor-dashboard/src/components/MenuToggle.tsx
Michał Droń d5c9a3dae8
Add trailing commas (#2062)
* Require trailing commas

* Add trailing commas

* Add trailing commas in testUtils dir

* Add trailing commas
2022-06-21 11:36:55 +02:00

42 lines
744 B
TypeScript

import React from "react";
interface MenuToggleProps {
ariaOwns?: string;
children: (props: {
actions: {
open: () => void;
close: () => void;
};
open: boolean;
}) => React.ReactElement<any>;
}
interface MenuToggleState {
open: boolean;
}
class MenuToggle extends React.Component<MenuToggleProps, MenuToggleState> {
state = {
open: false,
};
handleClick = () => {
this.setState({ open: true });
};
handleClose = () => {
this.setState({ open: false });
};
render() {
const { children } = this.props;
const { open } = this.state;
return children({
actions: { close: this.handleClose, open: this.handleClick },
open,
});
}
}
export default MenuToggle;