Browse Source

feature(channelform): enable search for peers in channel form

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
7d749fa090
  1. 23
      app/app.global.scss
  2. 3
      app/components/ChannelForm/Footer.scss
  3. 91
      app/components/ChannelForm/StepOne.js
  4. 2
      app/components/ChannelForm/StepOne.scss
  5. 2
      app/components/ChannelForm/StepThree.scss
  6. 2
      app/components/ChannelForm/StepTwo.scss
  7. 6
      app/components/Wallet/Wallet.scss

23
app/app.global.scss

@ -76,7 +76,7 @@ body {
// buttons
.buttonPrimary {
.buttonPrimary, .buttonSecondary {
-webkit-user-select: none;
cursor: pointer;
display: block;
@ -90,17 +90,32 @@ body {
transition: none;
position: relative;
color: white;
background-color: $main;
box-shadow: 0 3px 0 0 $darkestgrey;
margin-bottom: 5px;
&:active {
box-shadow: inset 0 1px 1px 1px $darkestgrey;
transform: translate(0px, 3px);
outline: 0;
}
}
.buttonPrimary {
background-color: $main;
box-shadow: 0 3px 0 0 darken($main, 10%);
&:active {
box-shadow: inset 0 1px 1px 1px darken($main, 10%);
}
}
.buttonSecondary {
background-color: $secondary;
box-shadow: 0 3px 0 0 darken($secondary, 10%);
&:active {
box-shadow: inset 0 1px 1px 1px darken($secondary, 10%);
}
}
.buttonContainer.circleContainer {
display: inline-block;
width: auto;

3
app/components/ChannelForm/Footer.scss

@ -1,3 +1,5 @@
@import '../../variables.scss';
.footer {
display: flex;
flex-direction: row;
@ -9,6 +11,7 @@
div {
padding: 18px 60px 15px 60px;
color: $black;
}
}
}

91
app/components/ChannelForm/StepOne.js

@ -1,46 +1,69 @@
import React from 'react'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { MdSearch } from 'react-icons/lib/md'
import styles from './StepOne.scss'
const StepOne = ({ peers, changeStep, setNodeKey }) => {
const peerClicked = (peer) => {
class StepOne extends Component {
constructor(props) {
super(props);
this.state = {
peers: props.peers,
searchQuery: ''
}
this.onSearchQuery = this.onSearchQuery.bind(this)
this.peerClicked = this.peerClicked.bind(this)
}
onSearchQuery(searchQuery) {
const peers = this.props.peers.filter(peer => peer.pub_key.includes(searchQuery))
this.setState({ peers, searchQuery })
}
peerClicked(peer) {
const { setNodeKey, changeStep } = this.props
setNodeKey(peer.pub_key)
changeStep(2)
}
return (
<div>
<div className={styles.search}>
<label className={`${styles.label} ${styles.input}`} htmlFor='peersSearch'>
<MdSearch />
</label>
<input
value={''}
onChange={event => console.log('event: ', event)}
className={`${styles.text} ${styles.input}`}
placeholder='Search your peers by their public key'
type='text'
id='peersSearch'
/>
</div>
render() {
const { peers, searchQuery } = this.state
return (
<div>
<div className={styles.search}>
<label className={`${styles.label} ${styles.input}`} htmlFor='peersSearch'>
<MdSearch />
</label>
<input
value={searchQuery}
onChange={event => this.onSearchQuery(event.target.value)}
className={`${styles.text} ${styles.input}`}
placeholder='Search your peers by their public key'
type='text'
id='peersSearch'
/>
</div>
<ul className={styles.peers}>
{peers.length &&
peers.map(peer => (
<li
key={peer.peer_id}
className={styles.peer}
onClick={() => peerClicked(peer)}
>
<h4>{peer.address}</h4>
<h1>{peer.pub_key}</h1>
</li>
)
)}
</ul>
</div>
)
<ul className={styles.peers}>
{peers.length > 0 &&
peers.map(peer => (
<li
key={peer.peer_id}
className={styles.peer}
onClick={() => this.peerClicked(peer)}
>
<h4>{peer.address}</h4>
<h1>{peer.pub_key}</h1>
</li>
)
)}
</ul>
</div>
)
}
}
StepOne.propTypes = {}

2
app/components/ChannelForm/StepOne.scss

@ -1,8 +1,6 @@
@import '../../variables.scss';
.peers {
// margin-bottom: 50px;
h2 {
text-transform: uppercase;
font-weight: 200;

2
app/components/ChannelForm/StepThree.scss

@ -5,7 +5,7 @@
padding: 20px;
.explainer {
margin: 20px 0 50px 0;
margin: 0px 0 50px 0;
padding-bottom: 20px;
border-bottom: 1px solid $lightgrey;

2
app/components/ChannelForm/StepTwo.scss

@ -5,7 +5,7 @@
padding: 20px;
.explainer {
margin: 20px 0 50px 0;
margin: 0px 0 50px 0;
padding-bottom: 20px;
border-bottom: 1px solid $lightgrey;

6
app/components/Wallet/Wallet.scss

@ -52,9 +52,9 @@
.rightContent {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex-direction: row;
justify-content: flex-end;
align-items: right;
height: calc(100% - 50px);
div {

Loading…
Cancel
Save