{"size": 1398, "ext": "js", "max_stars_repo_path": "src/Views/Profile/interestsView.js", "max_stars_repo_name": "juliotorresmoreno/webapp-front", "max_stars_repo_stars_event_min_datetime": "2017-06-15T17:40:27.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-15T17:40:27.000Z", "max_issues_repo_path": "src/Views/Profile/interestsView.js", "max_issues_repo_name": "juliotorresmoreno/webapp-front", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Views/Profile/interestsView.js", "max_forks_repo_name": "juliotorresmoreno/webapp-front", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.8461538462, "max_line_length": 92, "alphanum_fraction": 0.5128755365}
import React from 'react';

import { Form } from 'semantic-ui-react'
import InterestsViewCtrl from './interestsView.ctrl';

export default class InterestsView extends InterestsViewCtrl {
    form = {};
    constructor(args) {
        super(args);
        if(this.props.store.getState().profile) {
            this.form = Object.assign(this.props.store.getState().profile, this.form);
        }
    }
    render() {
        const campoComponent = (title, value) => {
            if (this.form[value]) {
                return (
                    <Form.Field>
                        <label>{this.props.store.lang.get(title)}</label>
                        {this.form[value]}
                    </Form.Field>
                );
            }
            return null;
        };
        return (
            <div>
                <Form onSubmit={(e) => e.preventDefault()}>
                    {campoComponent('profile_personalidad', 'personalidad')}
                    {campoComponent('profile_intereses', 'intereses')}
                    {campoComponent('profile_series', 'series')}
                    {campoComponent('profile_musica', 'musica')}
                    {campoComponent('profile_creencias_religiosas', 'creencias_religiosas')}
                    {campoComponent('profile_creencias_politicas', 'creencias_politicas')}
                </Form>
            </div>
        );
    }
}