on f7eb6eb help sign in
bridge/src/components/ValidatedBlockie.js
66 lines 1.3 kB history raw
1import React from 'react'
2import PropTypes from 'prop-types'
3import makeBlockie from 'ethereum-blockies-base64'
5const ValidatedBlockie = ({
6 className,
7 children,
8 style,
9 color,
10 address,
11 size,
12 validator,
13 displayPass,
14 displayFailure,
15 focussed,
16 beenFocussed
17}) => {
19 const colorStyle = styleSelector(displayPass, displayFailure, focussed);
21 return (
22 <div className={`${className}`} style={style}>
23 { displayPass
24 ? <img
25 alt={ address }
26 src={ makeBlockie(address) }
27 style={{
28 width: size,
29 height: size,
30 }} />
31 : <div className={''} style={{
32 backgroundColor: colorStyle[1],
33 width: size,
34 height: size,
35 }} />
36 }
37 {
38 children
39 }
40 </div>
41 )
45const styleSelector = (pass, fail, focus) => {
46 if (fail === true) return ['#FFFFFF', '#F8C134'];
47 if (pass === true) return ['#FFFFFF', '#2AA779'];
48 if (focus === true) return ['#FFFFFF', '#4330FC'];
49 return ['#FFFFFF', '#7F7F7F'];
53ValidatedBlockie.propTypes = {
54 className: PropTypes.string,
55 children: PropTypes.node,
56 style: PropTypes.object,
57};
60ValidatedBlockie.defaultProps = {
61 className: '',
62 style: {},
63};
66export default ValidatedBlockie;