Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 310 | Rev 314 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
306 geraldo 1
import React from "react";
2
import Option from "../option/Option";
3
 
4
const Question = (props) => {
310 geraldo 5
 
306 geraldo 6
    // get props
7
    const { question } = props;
8
 
9
    return (
313 geraldo 10
        <div className="col-md-12 col-sm-12 col-xs-12 np-padding">
310 geraldo 11
            <div className="form-group" >
12
                <div
13
                    dangerouslySetInnerHTML={{ __html: question.text }}
14
                    className="title"
15
                />
16
            </div>
306 geraldo 17
            {question.type == 'open' &&
310 geraldo 18
                <div className="form-group">
306 geraldo 19
                    {question.multiline == 1 ? (
20
                        <textarea
21
                            className="form-control"
22
                            rows="5"
23
                            maxLength={question.maxlength}
24
                            name={question.slug_question}
25
                            id={question.slug_question}
26
                        ></textarea>
27
                    ) : (
28
                        <input
29
                            type="text"
30
                            className="form-control"
31
                            maxLength={question.maxlength}
32
                            name={question.slug_question}
33
                            id={question.slug_question} />
34
                    )}
35
                </div>
36
            }
37
            {question.type == 'rating-range' &&
310 geraldo 38
                <div className="form-group">
306 geraldo 39
                    {Array.apply(0, Array(question.range)).map((_, i) => {
40
                        return (
41
                            <div className="radio radio-inline">
42
 
43
                                <input
44
                                    key={i}
45
                                    type="radio"
46
                                    name={question.slug_question}
47
                                    id={question.slug_question}
48
                                    value={i} />
49
                                {i}
50
 
51
                            </div>
52
                        )
53
                    })}
54
                </div>
55
            }
310 geraldo 56
            {question.type == 'simple' || question.type == 'rating-open' || question.type == 'multiple' &&
57
                <div className="form-group">
306 geraldo 58
                    {question.options.length <= 0 &&
59
                        <Option question={question} />
60
 
61
                    }
62
                </div>
63
            }
310 geraldo 64
 
306 geraldo 65
        </div>
66
 
310 geraldo 67
 
306 geraldo 68
    )
69
}
70
 
71
export default Question;