Skip to content

Commit

Permalink
release 1.1.0 fix #10
Browse files Browse the repository at this point in the history
  • Loading branch information
yjose committed Apr 13, 2018
1 parent b8aa1ca commit 71abdfc
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 59 deletions.
50 changes: 25 additions & 25 deletions __test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`it should close on click outside popup (closeOnDocumentClick = true ) 1
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -120,7 +120,7 @@ exports[`it should close on click outside popup (closeOnDocumentClick = true ) 2
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -167,7 +167,7 @@ exports[`it should render correctly 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -204,7 +204,7 @@ exports[`it should render correctly on click 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -309,7 +309,7 @@ exports[`it should render correctly on click (triggerOn = 'click') 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -413,7 +413,7 @@ exports[`it should render correctly on click and will update the the popup conte
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -520,7 +520,7 @@ exports[`it should render correctly on click and will update the the popup conte
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -567,7 +567,7 @@ exports[`it should render correctly on click and will update the trigger text
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -667,7 +667,7 @@ exports[`it should render correctly on click and will update the trigger text
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -713,7 +713,7 @@ exports[`it should render correctly on hover (triggerOn = 'focus') 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -762,7 +762,7 @@ exports[`it should render correctly on hover (triggerOn = 'hover') 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -813,7 +813,7 @@ exports[`it should rendered in the bottom center position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -920,7 +920,7 @@ exports[`it should rendered in the bottom left position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1027,7 +1027,7 @@ exports[`it should rendered in the bottom right position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1134,7 +1134,7 @@ exports[`it should rendered in the left bottom position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1241,7 +1241,7 @@ exports[`it should rendered in the left center position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1348,7 +1348,7 @@ exports[`it should rendered in the left top position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1455,7 +1455,7 @@ exports[`it should rendered in the right bottom position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1562,7 +1562,7 @@ exports[`it should rendered in the right center position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1669,7 +1669,7 @@ exports[`it should rendered in the right top position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1776,7 +1776,7 @@ exports[`it should rendered in the top center position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1883,7 +1883,7 @@ exports[`it should rendered in the top left position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -1990,7 +1990,7 @@ exports[`it should rendered in the top right position 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -2096,7 +2096,7 @@ exports[`it shouldn't close on click outside popup 1`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down Expand Up @@ -2202,7 +2202,7 @@ exports[`it shouldn't close on click outside popup 2`] = `
closeOnEscape={true}
contentStyle={Object {}}
defaultOpen={false}
lockScroll={true}
lockScroll={false}
modal={false}
mouseEnterDelay={100}
mouseLeaveDelay={100}
Expand Down
39 changes: 22 additions & 17 deletions docs/src/containers/Sidebar.js
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"
};
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactjs-popup",
"version": "1.0.8",
"version": "1.1.0",
"description": "React Popup Component - Modals,Tooltips and Menus —  All in one",
"main": "reactjs-popup.cjs.js",
"module": "reactjs-popup.es.js",
Expand Down
6 changes: 3 additions & 3 deletions lib/reactjs-popup.cjs.js
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.
*/
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions lib/reactjs-popup.es.js
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.
*/
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions lib/reactjs-popup.js
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.
*/
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down
Loading

0 comments on commit 71abdfc

Please sign in to comment.