-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c2e261
commit 8713af4
Showing
7 changed files
with
102 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import { Card, Container, Menu } from "react-craftify-core"; | ||
import { Link } from "react-router-dom"; | ||
|
||
|
||
const Menus = () => { | ||
const [selectedItem, setSelectedItem] = useState(window.location.pathname.split("/")[1]); | ||
|
||
useEffect(() => { | ||
if (location !== prevLocation) { | ||
// Get the right selected item for the actual path | ||
setSelectedItem(window.location.pathname.split("/")[1]); | ||
} | ||
}, [location]); | ||
|
||
return ( | ||
<Container> | ||
<Card> | ||
<div className="componentBlock"> | ||
<h3 className="componentTitle">Menu</h3> | ||
<p className="componentDescr">Simple menu</p> | ||
|
||
<Card style={{ padding: 0 }}> | ||
<Menu | ||
style={{ width: 250, padding: "1.2rem 0" }} | ||
selectedItem={selectedItem} | ||
> | ||
<Menu.Item uniqueKey=""> | ||
<Link to="/">Menu item 1</Link> | ||
</Menu.Item> | ||
|
||
<Menu.Item uniqueKey="2"> | ||
<Link to="/2">Menu item 2</Link> | ||
</Menu.Item> | ||
|
||
<Menu.Item uniqueKey="3"> | ||
<Link to="/3">Menu item 3</Link> | ||
</Menu.Item> | ||
|
||
<Menu.Item uniqueKey="4"> | ||
<Link to="/4">Menu item 4</Link> | ||
</Menu.Item> | ||
|
||
<Menu.Item uniqueKey="5"> | ||
<Link to="/5">Menu item 5</Link> | ||
</Menu.Item> | ||
|
||
<Menu.Item uniqueKey="6"> | ||
<button>Menu item 6</button> | ||
</Menu.Item> | ||
</Menu> | ||
</Card> | ||
</div> | ||
</Card> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Menus; |
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,7 @@ | ||
.navbar { | ||
background: #fff; | ||
box-shadow: 0 2px 8px #f0f1f2; | ||
position: relative; | ||
z-index: 10; | ||
max-width: 100%; | ||
} |
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,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import './NavBar.css'; | ||
|
||
const Navbar = ({ children }) => { | ||
return ( | ||
<div className="navbar"> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
Navbar.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
export default Navbar; |
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