diff --git a/.eslintrc.json b/.eslintrc.json index 402a1dc..68c39ec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,7 +2,9 @@ "extends": ["airbnb", "plugin:prettier/recommended"], "plugins": ["prettier"], "rules": { - "prettier/prettier": "error" + "prettier/prettier": ["error", { + "endOfLine":"auto" + }] }, "env": { "browser": true, diff --git a/src/common/components/DappList/DappList.jsx b/src/common/components/DappList/DappList.jsx index e28fafb..ef63ed5 100644 --- a/src/common/components/DappList/DappList.jsx +++ b/src/common/components/DappList/DappList.jsx @@ -20,7 +20,7 @@ const DappList = props => { } DappList.defaultProps = { - showActionButtons: false, + showActionButtons: true, } DappList.propTypes = { diff --git a/src/common/components/DappListItem/DappListItem.container.js b/src/common/components/DappListItem/DappListItem.container.js new file mode 100644 index 0000000..c663690 --- /dev/null +++ b/src/common/components/DappListItem/DappListItem.container.js @@ -0,0 +1,16 @@ +import { connect } from 'react-redux' +import DappListItem from './DappListItem' +import { + showDownVoteAction, + showUpVoteAction, +} from '../../../modules/Vote/Vote.reducer' + +const mapDispatchToProps = dispatch => ({ + onClickUpVote: () => dispatch(showUpVoteAction()), + onClickDownVote: () => dispatch(showDownVoteAction()), +}) + +export default connect( + null, + mapDispatchToProps, +)(DappListItem) diff --git a/src/common/components/DappListItem/DappListItem.jsx b/src/common/components/DappListItem/DappListItem.jsx index 13c75eb..b18bab3 100644 --- a/src/common/components/DappListItem/DappListItem.jsx +++ b/src/common/components/DappListItem/DappListItem.jsx @@ -1,4 +1,5 @@ import React from 'react' +import PropTypes from 'prop-types' import ReactImageFallback from 'react-image-fallback' import { DappModel } from '../../utils/models' import styles from './DappListItem.module.scss' @@ -16,6 +17,8 @@ const DappListItem = props => { isRanked, position, showActionButtons, + onClickUpVote, + onClickDownVote, } = props return ( @@ -42,14 +45,14 @@ const DappListItem = props => { SNT 12,345 - + Upvote - - + + Downvote - +

)} @@ -62,6 +65,9 @@ DappListItem.defaultProps = { showActionButtons: false, } -DappListItem.propTypes = DappModel +DappListItem.propTypes = Object.assign({}, DappModel, { + onClickUpVote: PropTypes.func.isRequired, + onClickDownVote: PropTypes.func.isRequired, +}) export default DappListItem diff --git a/src/common/components/DappListItem/DappListItem.module.scss b/src/common/components/DappListItem/DappListItem.module.scss index 363d0cf..06060fb 100644 --- a/src/common/components/DappListItem/DappListItem.module.scss +++ b/src/common/components/DappListItem/DappListItem.module.scss @@ -60,8 +60,9 @@ .sntAmount { font-size: calculateRem(12); font-weight: 500; - width: 80px; + // width: 80px; display: inline-block; + margin-right: calculateRem(12); } .sntAmount img { @@ -75,8 +76,13 @@ color: $link-color; font-weight: 600; text-decoration: none; - width: calculateRem(80); + // width: calculateRem(80); display: inline-block; + cursor: pointer; +} + +.vote:not(:last-child) { + margin-right: calculateRem(12); } .vote img { diff --git a/src/common/components/DappListItem/index.js b/src/common/components/DappListItem/index.js index 4bfc56d..6c93fda 100644 --- a/src/common/components/DappListItem/index.js +++ b/src/common/components/DappListItem/index.js @@ -1,3 +1,3 @@ -import DappListItem from './DappListItem' +import DappListItem from './DappListItem.container' export default DappListItem diff --git a/src/common/components/Modal/Modal.jsx b/src/common/components/Modal/Modal.jsx new file mode 100644 index 0000000..2fd0c96 --- /dev/null +++ b/src/common/components/Modal/Modal.jsx @@ -0,0 +1,37 @@ +import React from 'react' +import PropTypes from 'prop-types' +import styles from './Modal.module.scss' + +const Modal = props => { + const { visible, children, modalClassName, contentClassName } = props + + return ( +
+
+
+
+
{visible && children}
+
+
+ ) +} + +Modal.defaultProps = { + modalClassName: '', + contentClassName: '', +} + +Modal.propTypes = { + visible: PropTypes.bool.isRequired, + modalClassName: PropTypes.string, + contentClassName: PropTypes.string, + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node, + ]).isRequired, +} + +export default Modal diff --git a/src/common/components/Modal/Modal.module.scss b/src/common/components/Modal/Modal.module.scss new file mode 100644 index 0000000..fb82459 --- /dev/null +++ b/src/common/components/Modal/Modal.module.scss @@ -0,0 +1,53 @@ +.wrapper { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + position: fixed; + left: 0; + top: 0; + pointer-events: none; + opacity: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 4096; + + transition-property: opacity; + transition-duration: 0.25s; + + .window { + width: 800px; + max-height: 90%; + line-height: normal; + position: relative; + background: #f3f3f3; + box-shadow: 0px 0px 17px 0px #bbb; + overflow-x: hidden; + overflow-y: auto; + } +} + +.wrapper.active { + pointer-events: auto; + opacity: 1; +} + +// .PopupWindowWrapper > .PopupWindow > .Close { +// width:16px; height:16px; line-height:16px; +// position:absolute; +// right:0; top:0; +// font-size:24px; +// padding:8px; +// transform:rotate(45deg); +// z-index:1; +// cursor:pointer; +// } + +// .PopupWindowWrapper { +// background:transparent; +// } + +// .PopupWindowWrapper > .PopupWindow { +// background:transparent; +// box-shadow:none; +// } diff --git a/src/common/components/Modal/index.js b/src/common/components/Modal/index.js new file mode 100644 index 0000000..498702f --- /dev/null +++ b/src/common/components/Modal/index.js @@ -0,0 +1,3 @@ +import Modal from './Modal' + +export default Modal diff --git a/src/common/data/vote.js b/src/common/data/vote.js new file mode 100644 index 0000000..5e9b41c --- /dev/null +++ b/src/common/data/vote.js @@ -0,0 +1,5 @@ +const vote = { + visible: false, +} + +export default vote diff --git a/src/common/redux/reducers.js b/src/common/redux/reducers.js index d9c0024..3d6a30f 100644 --- a/src/common/redux/reducers.js +++ b/src/common/redux/reducers.js @@ -2,10 +2,12 @@ import { combineReducers } from 'redux' import { connectRouter } from 'connected-react-router' import dapps from '../../modules/Dapps/Dapps.reducer' import selectedCategory from '../../modules/CategorySelector/CategorySelector.reducer' +import vote from '../../modules/Vote/Vote.reducer' export default history => combineReducers({ router: connectRouter(history), dapps, selectedCategory, + vote, }) diff --git a/src/modules/App/Router.jsx b/src/modules/App/Router.jsx index d1723bb..6dbe35f 100644 --- a/src/modules/App/Router.jsx +++ b/src/modules/App/Router.jsx @@ -3,15 +3,15 @@ import { Route, Switch } from 'react-router-dom' import Home from '../Home' import Filtered from '../Filtered' import RecentlyAdded from '../RecentlyAdded' -import Vote from '../Vote' import Dapps from '../Dapps' +import Vote from '../Vote' -export default () => ( - +export default () => [ + - - -) + , + , +] diff --git a/src/modules/Home/Home.jsx b/src/modules/Home/Home.jsx index 5899b43..73b5d42 100644 --- a/src/modules/Home/Home.jsx +++ b/src/modules/Home/Home.jsx @@ -37,7 +37,7 @@ class Home extends React.Component { - {/* */} +