blob: 3912ca2011a878555324a0cc849cba4c7440c709 [file] [log] [blame]
pineafana0e4b9b2021-11-02 21:10:49 +00001import Header from '../../Components/Header'
2import { Component } from 'react'
3import Styles from '../../styles/clicksforms/form.module.css';
4import Paragraph from '../../Components/Paragraph';
5import Question from '../../Components/ClicksForms/Question';
6
7export default class Form extends Component {
8 constructor(props) {
9 super(props);
10 this.form = {
11 'id': '1629451712.871201',
12 'active': true, 'anonymous': false, 'guild': 684492926528651336, 'created_by': 438733159748599813,
13 'name': 'Example form', 'description': 'The default form',
14 'required_roles': [], 'disallowed_roles': [], 'given_roles': [], 'removed_roles': [],
15 'auto_accept': false,
16 'questions': [
17 {
18 'type': 'text', 'title': 'Text answer', 'description': 'some description',
19 'colour': 'red', 'options': {'min': 1, 'max': 2000}, 'required': true, 'question': true, 'id': '1630426754.449609'
20 }, {
21 'type': 'number', 'title': 'Number', 'description': 'Type something over 2 to trigger response validation',
22 'colour': 'orange', 'options': {'min': 0, 'max': 2}, 'required': true, 'question': true, 'id': '1630426754.449615'
23 }, {
24 'type': 'multichoice', 'title': 'Multiple choice!', 'description': '', 'colour': 'yellow', 'options': {
25 'min': 1, 'max': 2, 'options': {'0': ['circl', false], '1': ['skware', false], '3': ['no', false]}
26 },
27 'required': false, 'question': true, 'id': '1630426754.449619'
28 }, {
29 'type': 'fileupload', 'title': 'Files', 'description': '',
30 'colour': 'green', 'options': {}, 'required': false, 'question': true, 'id': '1630426754.449629'
31 }, {
32 'type': 'time', 'title': 'Enter a time', 'description': '',
33 'colour': 'blue', 'options': {}, 'required': true, 'question': true, 'id': '1630426754.449632'
34 }, {
35 'type': 'date', 'title': 'when', 'description': '',
36 'colour': 'purple', 'options': {}, 'required': true, 'question': true, 'id': '1630426754.449635'
37 }
38 ]
39 }
40 }
41
42 render() {
43 return (
44 <>
45 <Header
46 name={this.form.name}
47 subtext={this.form.description + (this.form.active ? '' : <><br />This form is not accepting responses. Please check back later</>)}
48 gradient={["71AFE5", "6576CC"]}
pineafana841c762021-11-14 21:21:04 +000049 wave="web/waves/header/clicksforms"
pineafana0e4b9b2021-11-02 21:10:49 +000050 buttons={[]}
51 />
52 <div id="start" />
53 <div className={Styles.form}>
54 <div className={Styles.header}>
55 Once completing this form, your response will be recorded
56 {this.form.anonymous ? " and your name will not be shown" : " and your username will be visible"}
57 </div>
58 <div className={Styles.body}>
59 {
60 this.form.questions.map((question, index) => {
61 return (
62 <>
63 <Question
64 key={index}
65 title={question.title}
66 description={question.description}
67 colour={question.colour}
68 type={question.type}
69 options={question.options}
70 required={question.required}
71 />
72 </>
73 )
74 })
75 }
76 </div>
77 </div>
78 </>
79 )
80 }
81}