mirror of
https://github.com/usatiuk/writer.git
synced 2025-10-29 00:17:48 +01:00
move navbar menu to a separate function
This commit is contained in:
@@ -78,34 +78,7 @@ export class HomeComponent extends React.PureComponent<IHomeProps> {
|
||||
{this.props.user.username}
|
||||
</Button>
|
||||
}
|
||||
content={
|
||||
<Menu>
|
||||
<Menu.Item
|
||||
icon="log-out"
|
||||
text="Logout"
|
||||
onClick={this.props.logout}
|
||||
/>
|
||||
{this.props.darkMode ? (
|
||||
<Menu.Item
|
||||
icon="flash"
|
||||
text="Light Mode"
|
||||
onClick={
|
||||
this.props
|
||||
.dispatchToggleDarkMode
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Menu.Item
|
||||
icon="moon"
|
||||
text="Dark Mode"
|
||||
onClick={
|
||||
this.props
|
||||
.dispatchToggleDarkMode
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Menu>
|
||||
}
|
||||
content={this.menu()}
|
||||
/>
|
||||
</Navbar.Group>
|
||||
</Navbar>
|
||||
@@ -133,7 +106,10 @@ export class HomeComponent extends React.PureComponent<IHomeProps> {
|
||||
}}
|
||||
>
|
||||
{(_location: any) => (style: any) => (
|
||||
<animated.div style={style} className="viewComponent">
|
||||
<animated.div
|
||||
style={style}
|
||||
className="viewComponent"
|
||||
>
|
||||
<Switch location={_location}>
|
||||
<Route
|
||||
path="/docs/:id/edit"
|
||||
@@ -153,6 +129,31 @@ export class HomeComponent extends React.PureComponent<IHomeProps> {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private menu() {
|
||||
return (
|
||||
<Menu>
|
||||
<Menu.Item
|
||||
icon="log-out"
|
||||
text="Logout"
|
||||
onClick={this.props.logout}
|
||||
/>
|
||||
{this.props.darkMode ? (
|
||||
<Menu.Item
|
||||
icon="flash"
|
||||
text="Light Mode"
|
||||
onClick={this.props.dispatchToggleDarkMode}
|
||||
/>
|
||||
) : (
|
||||
<Menu.Item
|
||||
icon="moon"
|
||||
text="Dark Mode"
|
||||
onClick={this.props.dispatchToggleDarkMode}
|
||||
/>
|
||||
)}
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state: IAppState) {
|
||||
|
||||
Reference in New Issue
Block a user