Skip to content

Commit

Permalink
Make Navbar buttons configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelbej committed Mar 27, 2020
1 parent 6ab8baa commit c4b49a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 8 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ import TxList from './views/TxList';
import Account from './views/Account';
import Contract from './views/Contract';

const menu = [
{ path: "/", icon: "home", label: "Home" },
{ path: "/block", icon: "cubes", label: "Blocks" },
{ path: "/tx", icon: "content", label: "Transactions" },
{ path: "/contract", icon: "signup", label: "Contracts" },
];

const App = () => (
<Router>
<Container>
<Navbar />
<Navbar menu={menu} />
<BlockchainInfo />
<Container style={{ marginTop: '1em' }}>
<Switch>
Expand Down
9 changes: 4 additions & 5 deletions client/src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {
Icon,
} from 'semantic-ui-react';

const Navbar = () => (
const Navbar = ({ menu }) => (
<Container>
<Menu icon="labeled">
<Menu.Item as={Link} to="/"><Icon name="home" color="orange" />Home</Menu.Item>
<Menu.Item as={Link} to="/block"><Icon name="cubes" color="orange" />Blocks</Menu.Item>
<Menu.Item as={Link} to="/tx"><Icon name="content" color="orange" />Transactions</Menu.Item>
<Menu.Item as={Link} to="/contract"><Icon name="signup" color="orange" />Contracts</Menu.Item>
{menu.map(({ path, icon, label }) => (
<Menu.Item key={label} as={Link} to={path}><Icon name={icon} color="orange" />{label}</Menu.Item>
))}
</Menu>
</Container>
);
Expand Down

0 comments on commit c4b49a0

Please sign in to comment.