|
|
@ -3,25 +3,30 @@ const createElement = require('react').createElement |
|
|
|
const blockies = require("ethereum-blockies"); |
|
|
|
const blockies = require("ethereum-blockies"); |
|
|
|
|
|
|
|
|
|
|
|
class BlockiesIdenticon extends Component { |
|
|
|
class BlockiesIdenticon extends Component { |
|
|
|
|
|
|
|
|
|
|
|
constructor(props) { |
|
|
|
constructor(props) { |
|
|
|
super(props); |
|
|
|
super(props); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getOpts () { |
|
|
|
getOpts () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
seed: this.props.seed || "foo", |
|
|
|
seed: this.props.seed, |
|
|
|
color: this.props.color || "#dfe", |
|
|
|
color: this.props.color, |
|
|
|
bgcolor: this.props.bgcolor || "#a71", |
|
|
|
bgcolor: this.props.bgcolor, |
|
|
|
size: this.props.size || 15, |
|
|
|
size: this.props.size, |
|
|
|
scale: this.props.scale || 3, |
|
|
|
scale: this.props.scale, |
|
|
|
spotcolor: this.props.spotcolor || "#000" |
|
|
|
spotcolor: this.props.spotcolor, |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
componentDidMount() { |
|
|
|
this.draw(); |
|
|
|
this.draw(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
draw() { |
|
|
|
draw() { |
|
|
|
blockies.render(this.getOpts(), this.canvas); |
|
|
|
blockies.render(this.getOpts(), this.canvas); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return createElement("canvas", {ref: canvas => this.canvas = canvas}); |
|
|
|
return createElement("canvas", {ref: canvas => this.canvas = canvas}); |
|
|
|
} |
|
|
|
} |
|
|
|