Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move menu modules to an unique module
- Loading branch information
1 parent
c252053
commit 81dec68
Showing
21 changed files
with
104 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Icon, Menu } from "semantic-ui-react"; | ||
import { Icon, Menu as SemanticMenu } from "semantic-ui-react"; | ||
|
||
import { Component as AboutMenu } from "src/components/menu-about"; | ||
import { Component as Responsive } from "src/components/responsive"; | ||
|
||
import "./headerMenu.css"; | ||
|
||
export class HeaderMenu extends Component { | ||
render() { | ||
const UserMenu = this.props.userMenu; | ||
const SettingsMenu = this.props.settingsMenu; | ||
const HomeMenu = this.props.homeMenu; | ||
const Menu = this.props.Menu; | ||
return ( | ||
<Menu inverted size="small" fixed="top" className="sidebar-layout__header-menu"> | ||
<SemanticMenu inverted size="small" fixed="top" className="sidebar-layout__header-menu"> | ||
<Responsive device="desktop" className="sidebar-layout__header-menu__container"> | ||
<HomeMenu /> | ||
{this.props.menu} | ||
<Menu.Item position="right" className="sidebar-layout__header-menu__item--right"> | ||
<SettingsMenu /> | ||
<AboutMenu /> | ||
<UserMenu /> | ||
</Menu.Item> | ||
<Menu.Home /> | ||
<Menu.Sections sections={this.props.sections} /> | ||
<SemanticMenu.Item position="right" className="sidebar-layout__header-menu__item--right"> | ||
<Menu.Settings /> | ||
<Menu.About /> | ||
<Menu.User /> | ||
</SemanticMenu.Item> | ||
</Responsive> | ||
<Responsive device="mobile" className="sidebar-layout__header-menu__container"> | ||
<Menu.Item | ||
<SemanticMenu.Item | ||
onClick={this.props.handleToggle} | ||
className="sidebar-layout__header-menu__item--toggle" | ||
> | ||
<Icon name="sidebar" /> | ||
</Menu.Item> | ||
<HomeMenu /> | ||
<Menu.Item position="right" className="sidebar-layout__header-menu__item--right"> | ||
<UserMenu /> | ||
</Menu.Item> | ||
</SemanticMenu.Item> | ||
<Menu.Home /> | ||
<SemanticMenu.Item position="right" className="sidebar-layout__header-menu__item--right"> | ||
<Menu.User /> | ||
</SemanticMenu.Item> | ||
</Responsive> | ||
</Menu> | ||
</SemanticMenu> | ||
); | ||
} | ||
} | ||
|
||
HeaderMenu.propTypes = { | ||
Menu: PropTypes.func, | ||
handleToggle: PropTypes.func, | ||
homeMenu: PropTypes.func, | ||
menu: PropTypes.node, | ||
settingsMenu: PropTypes.func, | ||
userMenu: PropTypes.func | ||
sections: PropTypes.array | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
import { Menu } from "semantic-ui-react"; | ||
import { Menu as SemanticMenu } from "semantic-ui-react"; | ||
|
||
import { Component as MainContainer } from "src/components/container-main"; | ||
import { Component as AboutMenu } from "src/components/menu-about"; | ||
|
||
export const SimpleLayout = ({ children, homeMenu = () => {} }) => { | ||
const HomeMenu = homeMenu; | ||
export const SimpleLayout = ({ children, Menu }) => { | ||
return ( | ||
<React.Fragment> | ||
<MainContainer>{children}</MainContainer> | ||
<Menu inverted={true} size="small" fixed="top" className="simple-layout__header-menu"> | ||
<HomeMenu /> | ||
<Menu.Item position="right" className="simple-layout__header-menu__item--right"> | ||
<AboutMenu /> | ||
</Menu.Item> | ||
</Menu> | ||
<SemanticMenu | ||
inverted={true} | ||
size="small" | ||
fixed="top" | ||
className="simple-layout__header-menu" | ||
> | ||
<Menu.Home /> | ||
<SemanticMenu.Item position="right" className="simple-layout__header-menu__item--right"> | ||
<Menu.About /> | ||
</SemanticMenu.Item> | ||
</SemanticMenu> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
SimpleLayout.propTypes = { | ||
children: PropTypes.node, | ||
homeMenu: PropTypes.func | ||
Menu: PropTypes.func, | ||
children: PropTypes.node | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component } from "react"; | ||
|
||
import { Component as MenuSections } from "src/components/menu-sections"; | ||
import { Component as MenuAbout } from "src/components/menu-about"; | ||
|
||
import { HomeMenu } from "./views/HomeMenu"; | ||
import { SettingsMenu } from "./views/SettingsMenu"; | ||
import { UserMenu } from "./views/UserMenu"; | ||
|
||
export class Menu extends Component { | ||
static Home = HomeMenu; | ||
static Settings = SettingsMenu; | ||
static User = UserMenu; | ||
static Sections = MenuSections; | ||
static About = MenuAbout; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Menu } from "./Layouts"; | ||
|
||
import { store } from "./state/state"; | ||
import { setup } from "./setup"; | ||
|
||
Menu.store = store; | ||
Menu.setup = setup; | ||
|
||
export const Module = Menu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { init } from "./views/HomeMenu"; | ||
|
||
let config = { | ||
history: null, | ||
store: null | ||
}; | ||
|
||
export const setup = configuration => { | ||
config = { ...config, ...configuration }; | ||
init(config); | ||
}; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { NAMESPACE, historyChanged } from "./reducers"; | ||
|
||
export const store = { | ||
[NAMESPACE]: historyChanged | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.