Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Double click to select account creation type (#4986)
Browse files Browse the repository at this point in the history
* Extend links to whole container

* Add doubleClick to Account Creator
  • Loading branch information
ngotchac authored and jacogr committed Mar 22, 2017
1 parent a028e44 commit 67c225f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
8 changes: 8 additions & 0 deletions js/src/modals/CreateAccount/CreationType/creationType.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export default class CreationType extends Component {
items={ TYPES }
noStretch
onSelectClick={ this.onChange }
onSelectDoubleClick={ this.onSelect }
renderItem={ this.renderItem }
/>
);
Expand Down Expand Up @@ -180,4 +181,11 @@ export default class CreationType extends Component {

store.setCreateType(item.key);
}

onSelect = (item) => {
const { store } = this.props;

store.setCreateType(item.key);
store.nextStage();
}
}
9 changes: 7 additions & 2 deletions js/src/ui/Container/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ export default class Container extends Component {
to={ link }
>
{ card }
{ this.renderHover() }
</Link>
)
: card
: (
<div>
{ card }
{ this.renderHover() }
</div>
)
}
{ this.renderHover() }
</div>
);
}
Expand Down
26 changes: 19 additions & 7 deletions js/src/ui/SelectionList/selectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

import { noop } from 'lodash';
import React, { Component, PropTypes } from 'react';

import { StarIcon } from '~/ui/Icons';
Expand All @@ -29,8 +30,13 @@ export default class SelectionList extends Component {
noStretch: PropTypes.bool,
onDefaultClick: PropTypes.func,
onSelectClick: PropTypes.func.isRequired,
onSelectDoubleClick: PropTypes.func,
renderItem: PropTypes.func.isRequired
}
};

static defaultProps = {
onSelectDoubleClick: noop
};

render () {
const { items, noStretch } = this.props;
Expand All @@ -45,23 +51,28 @@ export default class SelectionList extends Component {
}

renderItem = (item, index) => {
const { isChecked, onDefaultClick, onSelectClick, renderItem } = this.props;
const { isChecked, onDefaultClick, onSelectClick, onSelectDoubleClick, renderItem } = this.props;
const isSelected = isChecked
? isChecked(item)
: item.checked;

const makeDefault = () => {
onDefaultClick(item);
const handleClick = () => {
onSelectClick(item);
return false;
};
const selectItem = () => {
onSelectClick(item);
const handleDoubleClick = () => {
onSelectDoubleClick(item);
return false;
};

let defaultIcon = null;

if (onDefaultClick) {
const makeDefault = () => {
onDefaultClick(item);
return false;
};

defaultIcon = (
<div className={ styles.overlay }>
{
Expand All @@ -85,7 +96,8 @@ export default class SelectionList extends Component {
<div className={ classes.join(' ') }>
<div
className={ styles.content }
onClick={ selectItem }
onClick={ handleClick }
onDoubleClick={ handleDoubleClick }
>
{ renderItem(item, index) }
</div>
Expand Down

0 comments on commit 67c225f

Please sign in to comment.