Sha256: e36c0462bffe15a3ff5b737ec13b708f4195c0ba506be41be7cad26d763567c4

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

var React = require('react');
var Mui = require('material-ui');
var Paper = Mui.Paper;
var iOSMixin = require('./iOSMixin');

var IdentityCard = React.createClass({

    mixins: [iOSMixin],

    componentDidMount: function() {
        var self= this;
        this._colorSelected = '#00bcd4';

    },

    getInitialState: function () {
        return  {
            isSelected: false
        }
    },

    handleSelectedIdentity: function() {
        var self = this;

        if(!this.props.hasBeenSelected) {

            this.props.onSelectedIdentity(true);

            // Show selection
            this.setState({
                isSelected: true
            });

            // Trigger native animation
            var callback = function() {
                // Exit point from identity-selector
                self.props.onSetRid(self.props.name);
            };
            setTimeout(callback, 500);
        }

    },

    render: function () {

        var selectedCardStyle = {
            backgroundColor: this._colorSelected,
            color: 'white'
        };

        // Copy
        var cardStyle = {};
        for(var p_ in this.props.cardStyle) {
            cardStyle[p_] = this.props.cardStyle[p_];
        }

        var className='identity-card';

        // Add properties if selected
        if(this.state.isSelected) {
            className += ' identity-card-selected';
            for(var p in selectedCardStyle) {
                cardStyle[p] = selectedCardStyle[p];
            }

        }

        return (

            <Paper className={className} style={cardStyle} onTouchTap={this.handleSelectedIdentity}  >

                <div className='card-name'>

                    <span> {this.props.name} </span>

                </div>



            </Paper>);
    }

});

module.exports = IdentityCard;

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
nutella_framework-0.6.18 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.17 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.16 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.15 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.13 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.12 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.11 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.10 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.9 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.8 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js
nutella_framework-0.6.7 framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js