on dffcebf help sign in
bridge/src/components/old/ValidatedBlockie.js
64 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}) => {
18 const colorStyle = styleSelector(displayPass, displayFailure, focussed);
20 return (
21 <div className={`${className}`} style={style}>
22 {displayPass ? (
23 <img
24 alt={address}
25 src={makeBlockie(address)}
26 style={{
27 width: size,
28 height: size,
29 }}
30 />
31 ) : (
32 <div
33 className={''}
34 style={{
35 backgroundColor: colorStyle[1],
36 width: size,
37 height: size,
38 }}
39 />
40 )}
41 {children}
42 </div>
43 );
44};
46const styleSelector = (pass, fail, focus) => {
47 if (fail === true) return ['#FFFFFF', '#F8C134'];
48 if (pass === true) return ['#FFFFFF', '#2AA779'];
49 if (focus === true) return ['#FFFFFF', '#4330FC'];
50 return ['#FFFFFF', '#7F7F7F'];
51};
53ValidatedBlockie.propTypes = {
54 className: PropTypes.string,
55 children: PropTypes.node,
56 style: PropTypes.object,
57};
59ValidatedBlockie.defaultProps = {
60 className: '',
61 style: {},
62};
64export default ValidatedBlockie;