-
Notifications
You must be signed in to change notification settings - Fork 208
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
Showing
10 changed files
with
63 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,63 @@ | ||
import React from 'react' | ||
import { NavLink } from 'react-static' | ||
import Popup from '../../../lib/reactjs-popup.es' | ||
import config from '../config.json' | ||
import React from "react"; | ||
import { NavLink } from "react-static"; | ||
import Popup from "../../../lib/reactjs-popup.es"; | ||
import config from "../config.json"; | ||
|
||
import '../css/sidebar.css' | ||
import "../css/sidebar.css"; | ||
|
||
export default class Sidebar extends React.Component { | ||
render () { | ||
const routes = Object.entries(config.menu).map(r => r[0]) | ||
render() { | ||
const routes = Object.entries(config.menu).map(r => r[0]); | ||
return [ | ||
<div className="sidebar website-sidebar" key="SW"> | ||
<Menu routes={routes} /> | ||
</div>, | ||
<div className="sidebar mobile-sidebar" key="SM"> | ||
<Popup | ||
modal | ||
overlayStyle={{ background: 'rgba(255,255,255,0.98' }} | ||
overlayStyle={{ background: "rgba(255,255,255,0.98" }} | ||
contentStyle={contentStyle} | ||
closeOnDocumentClick={false} | ||
lockScroll={true} | ||
trigger={open => <BurgerIcon open={open} />} | ||
> | ||
{close => <Menu routes={routes} close={close} />} | ||
</Popup> | ||
</div>, | ||
] | ||
</div> | ||
]; | ||
} | ||
} | ||
|
||
const Menu = ({ routes, close }) => ( | ||
<ul> | ||
{routes.map((r, i) => { | ||
if (r !== '') { | ||
if (r !== "") { | ||
return ( | ||
<li key={i}> | ||
<NavLink | ||
onClick={close} | ||
activeClassName="current" | ||
to={`/${r.replace(new RegExp(' ', 'g'), '-').toLowerCase()}/`} | ||
to={`/${r.replace(new RegExp(" ", "g"), "-").toLowerCase()}/`} | ||
> | ||
{r} | ||
</NavLink> | ||
</li> | ||
) | ||
); | ||
} | ||
})} | ||
</ul> | ||
) | ||
); | ||
|
||
const BurgerIcon = ({ open, ...props }) => ( | ||
<div className={open ? 'burger-menu open' : 'burger-menu'} {...props}> | ||
<div className={open ? "burger-menu open" : "burger-menu"} {...props}> | ||
<div className="bar1" key="b1" /> | ||
<div className="bar2" key="b2" /> | ||
<div className="bar3" key="b3" /> | ||
</div> | ||
) | ||
); | ||
|
||
const contentStyle = { background: 'rgba(255,255,255,0', width: '80%', border: 'none' } | ||
const contentStyle = { | ||
background: "rgba(255,255,255,0", | ||
width: "80%", | ||
border: "none" | ||
}; |
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,5 +1,5 @@ | ||
/*! | ||
* reactjs-popup v1.0.8 | ||
* reactjs-popup v1.1.0 | ||
* (c) 2018-present Youssouf EL AZIZI <[email protected]> | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -500,7 +500,7 @@ function (_React$PureComponent) { | |
closeOnDocumentClick = _props2.closeOnDocumentClick, | ||
on = _props2.on; | ||
var modal = this.state.modal; | ||
var overlay = this.state.isOpen && !on.includes("hover") && closeOnDocumentClick; | ||
var overlay = this.state.isOpen && !on.includes("hover"); | ||
var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip; | ||
return [this.state.isOpen && React.createElement("div", { | ||
key: "H", | ||
|
@@ -514,7 +514,7 @@ function (_React$PureComponent) { | |
key: "O", | ||
className: "popup-overlay", | ||
style: Object.assign({}, ovStyle, overlayStyle), | ||
onClick: this.closePopup | ||
onClick: closeOnDocumentClick ? this.closePopup : undefined | ||
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, { | ||
innerRef: this.setTriggerRef, | ||
key: "R" | ||
|
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,5 +1,5 @@ | ||
/*! | ||
* reactjs-popup v1.0.8 | ||
* reactjs-popup v1.1.0 | ||
* (c) 2018-present Youssouf EL AZIZI <[email protected]> | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -496,7 +496,7 @@ function (_React$PureComponent) { | |
closeOnDocumentClick = _props2.closeOnDocumentClick, | ||
on = _props2.on; | ||
var modal = this.state.modal; | ||
var overlay = this.state.isOpen && !on.includes("hover") && closeOnDocumentClick; | ||
var overlay = this.state.isOpen && !on.includes("hover"); | ||
var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip; | ||
return [this.state.isOpen && React.createElement("div", { | ||
key: "H", | ||
|
@@ -510,7 +510,7 @@ function (_React$PureComponent) { | |
key: "O", | ||
className: "popup-overlay", | ||
style: Object.assign({}, ovStyle, overlayStyle), | ||
onClick: this.closePopup | ||
onClick: closeOnDocumentClick ? this.closePopup : undefined | ||
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, { | ||
innerRef: this.setTriggerRef, | ||
key: "R" | ||
|
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,5 +1,5 @@ | ||
/*! | ||
* reactjs-popup v1.0.8 | ||
* reactjs-popup v1.1.0 | ||
* (c) 2018-present Youssouf EL AZIZI <[email protected]> | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -501,7 +501,7 @@ | |
closeOnDocumentClick = _props2.closeOnDocumentClick, | ||
on = _props2.on; | ||
var modal = this.state.modal; | ||
var overlay = this.state.isOpen && !on.includes("hover") && closeOnDocumentClick; | ||
var overlay = this.state.isOpen && !on.includes("hover"); | ||
var ovStyle = modal ? styles.overlay.modal : styles.overlay.tooltip; | ||
return [this.state.isOpen && React.createElement("div", { | ||
key: "H", | ||
|
@@ -515,7 +515,7 @@ | |
key: "O", | ||
className: "popup-overlay", | ||
style: Object.assign({}, ovStyle, overlayStyle), | ||
onClick: this.closePopup | ||
onClick: closeOnDocumentClick ? this.closePopup : undefined | ||
}, modal && this.renderContent()), this.state.isOpen && !modal && this.renderContent(), !!this.props.trigger && React.createElement(Ref, { | ||
innerRef: this.setTriggerRef, | ||
key: "R" | ||
|
Oops, something went wrong.