This is an automated email from the ASF dual-hosted git repository. marat pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push: new 7682e09 fix bug toggle button is not changing state (#127) 7682e09 is described below commit 7682e0957037eab2fb39e7a426e2b7f18b869f7d Author: Omkar Yadav <m...@f22.dev> AuthorDate: Thu Nov 25 20:56:32 2021 +0400 fix bug toggle button is not changing state (#127) --- karavan-app/src/main/webapp/src/MainToolbar.tsx | 34 ++++++------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/karavan-app/src/main/webapp/src/MainToolbar.tsx b/karavan-app/src/main/webapp/src/MainToolbar.tsx index b80d7b1..9eeb950 100644 --- a/karavan-app/src/main/webapp/src/MainToolbar.tsx +++ b/karavan-app/src/main/webapp/src/MainToolbar.tsx @@ -5,43 +5,25 @@ import { import './designer/karavan.css'; interface Props { - title: any - tools: any + title: React.ReactNode; + tools: React.ReactNode; } -interface State { - title: any - tools: React.Component -} - -export class MainToolbar extends React.Component<Props, State> { - - public state: State = { - title: this.props.title, - tools: this.props.tools - }; - - // componentDidUpdate = (prevProps: Readonly<Props>, prevState: Readonly<State>, snapshot?: any) => { - // if (prevState.tools !== this.props.tools) { - // this.setState({tools: this.props.tools}); - // } - // if (prevState.title !== this.props.title) { - // this.setState({title: this.props.title}); - // } - // } - +export class MainToolbar extends React.PureComponent<Props> { render() { + const { title, tools } = this.props; + return ( <PageSection className="tools-section" variant={PageSectionVariants.light}> <Flex className="tools" justifyContent={{default: 'justifyContentSpaceBetween'}}> <FlexItem> - {this.state.title} + {title} </FlexItem> <FlexItem> - {this.state.tools} + {tools} </FlexItem> </Flex> </PageSection> ); } -}; \ No newline at end of file +}