From cf7a05f80f68b5b1c8bcc0089679dd497cec2506 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 14 Jun 2015 23:53:32 -0800 Subject: first commit --- web/react/components/setting_picture.jsx | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 web/react/components/setting_picture.jsx (limited to 'web/react/components/setting_picture.jsx') diff --git a/web/react/components/setting_picture.jsx b/web/react/components/setting_picture.jsx new file mode 100644 index 000000000..62c889b7f --- /dev/null +++ b/web/react/components/setting_picture.jsx @@ -0,0 +1,55 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +module.exports = React.createClass({ + setPicture: function(file) { + if (file) { + var reader = new FileReader(); + + var img = this.refs.image.getDOMNode(); + reader.onload = function (e) { + $(img).attr('src', e.target.result) + }; + + reader.readAsDataURL(file); + } + }, + componentWillReceiveProps: function(nextProps) { + if (nextProps.picture) { + this.setPicture(nextProps.picture); + } + }, + render: function() { + var client_error = this.props.client_error ?
: null; + var server_error = this.props.server_error ?
: null; + + var img = null; + if (this.props.picture) { + img = (); + } else { + img = (); + } + + var self = this; + + return ( + + ); + } +}); -- cgit v1.2.3-1-g7c22