Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 308 | Ir a la última revisión | | 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) => {
5
 
6
    // get props
7
    const { question } = props;
8
 
9
    return (
10
        <div className="form-group" >
11
            <label>{question.text}</label>
12
            {question.type == 'open' &&
13
                <div>
14
                    {question.multiline == 1 ? (
15
                        <textarea
16
                            className="form-control"
17
                            rows="5"
18
                            maxLength={question.maxlength}
19
                            name={question.slug_question}
20
                            id={question.slug_question}
21
                        ></textarea>
22
                    ) : (
23
                        <input
24
                            type="text"
25
                            className="form-control"
26
                            maxLength={question.maxlength}
27
                            name={question.slug_question}
28
                            id={question.slug_question} />
29
                    )}
30
                </div>
31
            }
32
            {question.type == 'rating-range' &&
33
                <div>
34
                    {Array.apply(0, Array(question.range)).map((_, i) => {
35
                        return (
36
                            <div className="radio radio-inline">
37
 
38
                                <input
39
                                    key={i}
40
                                    type="radio"
41
                                    name={question.slug_question}
42
                                    id={question.slug_question}
43
                                    value={i} />
44
                                {i}
45
 
46
                            </div>
47
                        )
48
                    })}
49
                </div>
50
            }
51
            {question.type == 'simple' || question.type == 'rating-open' || question.type=='multiple' &&
52
                <div>
53
                    {question.options.length <= 0 &&
54
                        <Option question={question} />
55
 
56
                    }
57
                </div>
58
            }
59
        </div>
60
 
61
    )
62
}
63
 
64
export default Question;