-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ryan Kim
committed
Oct 9, 2017
1 parent
1e4731f
commit 9443eb0
Showing
38 changed files
with
1,296 additions
and
1,393 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,27 @@ | ||
{ | ||
env: { | ||
development: { | ||
presets: [ | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
["env", { | ||
targets: { | ||
browsers: ["last 2 versions", "ie >= 11"] | ||
"targets": { | ||
"browsers": ["last 2 versions", "ie >= 11"] | ||
}, | ||
modules: false, | ||
useBuiltIns: true | ||
"useBuiltIns": true | ||
}], | ||
"react-hmre" | ||
] | ||
}, | ||
test: { | ||
presets: [ | ||
["env", { | ||
targets: { | ||
browsers: ["last 2 versions", "ie >= 11"] | ||
}, | ||
useBuiltIns: true | ||
}] | ||
"stage-2", | ||
"react" | ||
] | ||
} | ||
}, | ||
plugins: ["transform-object-rest-spread"], | ||
presets: [ | ||
"presets": [ | ||
["env", { | ||
targets: { | ||
browsers: ["last 2 versions", "ie >= 11"] | ||
"targets": { | ||
"browsers": ["last 2 versions", "ie >= 11"] | ||
}, | ||
modules: false, | ||
useBuiltIns: true | ||
"modules": false, | ||
"useBuiltIns": true | ||
}], | ||
"stage-2", | ||
"react" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,3 @@ coverage | |
lib | ||
node_modules | ||
npm-debug.log | ||
test-reports |
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,25 +1,21 @@ | ||
import { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { Modal, closePopup } from 'react-redux-popup'; | ||
import Menus from 'app/menus2'; | ||
import store from 'app/store'; | ||
|
||
const doSomethingAction = () => ({ type: 'DO_SOMETHING' }); | ||
const selector = state => state.modal; | ||
|
||
class ModalPopup extends Component { | ||
render() { | ||
return ( | ||
<div> | ||
<label>This is modal popup</label> | ||
<label>Open menu from the modal</label> | ||
<Menus /> | ||
<button onClick={this.props.doSomethingAction}>Activate</button> | ||
<button onClick={() => this.props.closePopup(this.props.id)}>OK</button> | ||
{this.props.isActivated && <label>Activated!</label>} | ||
</div> | ||
); | ||
} | ||
} | ||
const View = props => ( | ||
<div> | ||
<label>This is modal popup</label> | ||
<label>Open menu from the modal</label> | ||
<Menus /> | ||
<button onClick={props.doSomethingAction}>Activate</button> | ||
<button onClick={() => props.closePopup(props.id)}>OK</button> | ||
{props.isActivated && <label>Activated!</label>} | ||
</div> | ||
); | ||
|
||
export default Modal(connect(selector, { closePopup, doSomethingAction })(ModalPopup)); | ||
const ConnectedView = connect(selector, { closePopup, doSomethingAction })(View); | ||
|
||
export default props => <Modal id={props.id} render={() => <ConnectedView id={props.id}/>} />; |
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,29 @@ | ||
import { map } from 'lodash/fp'; | ||
import { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Popup } from 'react-redux-popup'; | ||
import MenuItem from 'app/components/popup-menu-item'; | ||
|
||
class PopupMenu extends Component { | ||
render() { | ||
return <div className="popup-menu__container">{this.renderMenuItems()}</div>; | ||
} | ||
|
||
renderMenuItems() { | ||
return map(item => { | ||
return <MenuItem {...item} key={item.label}/>; | ||
}, this.props.menuItems); | ||
} | ||
} | ||
const PopupMenu = props => ( | ||
<div className="popup-menu__container"> | ||
{props.menuItems.map(item => <MenuItem {...item} key={item.label} />)} | ||
</div> | ||
); | ||
|
||
PopupMenu.propTypes = { | ||
menuItems: PropTypes.arrayOf(PropTypes.shape({ | ||
label: PropTypes.string.isRequired, | ||
url: PropTypes.string | ||
})).isRequired | ||
url: PropTypes.string, | ||
})).isRequired, | ||
}; | ||
|
||
|
||
export default Popup(PopupMenu); | ||
export default props => ( | ||
<Popup | ||
className="popup-menu" | ||
getRect={props.getRect} | ||
id={props.id} | ||
offset={props.offset} | ||
render={() => <PopupMenu menuItems={props.menuItems} />} | ||
/> | ||
); |
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
Oops, something went wrong.