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,40 +78,13 @@ export class HomeComponent extends React.PureComponent<IHomeProps> {
|
|||||||
{this.props.user.username}
|
{this.props.user.username}
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
content={
|
content={this.menu()}
|
||||||
<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>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Navbar.Group>
|
</Navbar.Group>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
<div id="MainScreen" className="animationWrapper">
|
<div id="MainScreen" className="animationWrapper">
|
||||||
<Transition
|
<Transition
|
||||||
native={true}
|
native={true}
|
||||||
config={{
|
config={{
|
||||||
...config.default,
|
...config.default,
|
||||||
clamp: true,
|
clamp: true,
|
||||||
@@ -133,7 +106,10 @@ export class HomeComponent extends React.PureComponent<IHomeProps> {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(_location: any) => (style: any) => (
|
{(_location: any) => (style: any) => (
|
||||||
<animated.div style={style} className="viewComponent">
|
<animated.div
|
||||||
|
style={style}
|
||||||
|
className="viewComponent"
|
||||||
|
>
|
||||||
<Switch location={_location}>
|
<Switch location={_location}>
|
||||||
<Route
|
<Route
|
||||||
path="/docs/:id/edit"
|
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) {
|
function mapStateToProps(state: IAppState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user