saleor-dashboard/src/components/Tab/Tabs.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

29 lines
553 B
TypeScript

import React from "react";
export interface TabsProps {
children: (props: {
changeTab: (index: number) => void;
currentTab: number;
}) => React.ReactNode;
}
interface TabsState {
currentTab: number;
}
class Tabs extends React.Component<TabsProps, TabsState> {
state: TabsState = {
currentTab: 0,
};
changeTab = (index: number) => this.setState({ currentTab: index });
render() {
return this.props.children({
changeTab: this.changeTab,
currentTab: this.state.currentTab,
});
}
}
export default Tabs;