Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 335 | Rev 340 | 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
332 geraldo 7
    const { question, backendVars } = props;
306 geraldo 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" >
333 geraldo 12
                <h6>{backendVars.LBL_QUESTION} #{question.position + 1}</h6>
310 geraldo 13
                <div
14
                    dangerouslySetInnerHTML={{ __html: question.text }}
15
                    className="title"
16
                />
17
            </div>
306 geraldo 18
            {question.type == 'open' &&
310 geraldo 19
                <div className="form-group">
306 geraldo 20
                    {question.multiline == 1 ? (
21
                        <textarea
22
                            className="form-control"
23
                            rows="5"
24
                            maxLength={question.maxlength}
25
                            name={question.slug_question}
26
                        ></textarea>
27
                    ) : (
28
                        <input
29
                            type="text"
30
                            className="form-control"
31
                            maxLength={question.maxlength}
333 geraldo 32
                            name={question.slug_question} />
306 geraldo 33
                    )}
34
                </div>
35
            }
36
            {question.type == 'rating-range' &&
310 geraldo 37
                <div className="form-group">
334 geraldo 38
                    {[...Array(parseInt(question.range))].map((x, i) => {
306 geraldo 39
                        return (
333 geraldo 40
                            <div className="checkbox"
41
                                key={i}>
306 geraldo 42
                                <input
43
                                    type="radio"
44
                                    name={question.slug_question}
336 geraldo 45
                                    value={i + 1} />
333 geraldo 46
                                <div className="option">
336 geraldo 47
                                    {i + 1}
333 geraldo 48
                                </div>
306 geraldo 49
                            </div>
50
                        )
51
                    })}
52
                </div>
53
            }
333 geraldo 54
            {(question.type == 'simple' || question.type == 'rating-open' || question.type == 'multiple') &&
310 geraldo 55
                <div className="form-group">
323 geraldo 56
                    {question.options.length > 0 &&
306 geraldo 57
                        <Option question={question} />
58
                    }
59
                </div>
60
            }
61
        </div>
62
    )
63
}
64
 
65
export default Question;