Skip to content

Commit 9030d7a

Browse files
committed
Initial commit
1 parent 557279c commit 9030d7a

File tree

9 files changed

+8016
-151
lines changed

9 files changed

+8016
-151
lines changed

db.sqlite3

0 Bytes
Binary file not shown.

frontend/src/components/dashboard/Create.js

Lines changed: 59 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Create extends Component {
152152
return (
153153
<div>
154154
<Navbar />
155-
<form className="flex m-4 space-x-4">
155+
<form className="flex flex-row flex-wrap m-4 gap-4">
156156
<InputField
157157
name="formName"
158158
placeholder="Form Name"
@@ -186,17 +186,15 @@ class Create extends Component {
186186
</button>
187187
</form>
188188
<form className="flex flex-col m-4 space-y-4">
189-
<table className="table table-fixed w-full border-collapse">
190-
<thead className="border-b-4 border-black">
191-
<tr>
192-
<th>Title</th>
193-
<th>Description</th>
194-
<th>Type</th>
195-
<th>Order</th>
196-
</tr>
197-
</thead>
198-
<tbody>{questions}</tbody>
199-
</table>
189+
<div className="w-full">
190+
<div className="w-full sm:inline-block hidden px-2 sm:px-4 border-black">
191+
<span className="inline-block w-2/6">Title</span>
192+
<span className="inline-block w-2/6">Description</span>
193+
<span className="inline-block w-1/6">Type</span>
194+
<span className="inline-block w-1/6">Order</span>
195+
</div>
196+
<div className="space-y-4">{questions}</div>
197+
</div>
200198
<button
201199
className="text-white rounded mt-2 bg-green-500 hover:bg-green-600 focus:bg-green-700"
202200
onClick={(event) => this.addNewQuestion(event)}
@@ -215,42 +213,54 @@ class QuestionTr extends Component {
215213
const types = ["number", "text"];
216214

217215
return (
218-
<tr className="border-2 border-black rounded">
219-
<td>
220-
<InputField
221-
name="title"
222-
placeholder="Question Title"
223-
value={this.props.question.title}
224-
type="text"
225-
onChange={(event) => this.props.onChange(event, this.props.index)}
226-
/>
227-
</td>
228-
<td>
229-
<InputField
230-
name="description"
231-
placeholder="Question Description"
232-
value={this.props.question.description}
233-
type="text"
234-
onChange={(event) => this.props.onChange(event, this.props.index)}
235-
/>
236-
</td>
237-
<td>
238-
<ListboxInput
239-
array={types}
240-
value={this.props.question.data_type}
241-
onChange={(type) => this.props.onChange(type, this.props.index)}
242-
/>
243-
</td>
244-
<td className="flex justify-around">
245-
<button
246-
type="button"
247-
className="btn bg-red-500 hover:bg-red-700 focus:bg-red-900"
248-
onClick={() => this.props.onDelete(this.props.index)}
249-
>
250-
Delete
251-
</button>
252-
</td>
253-
</tr>
216+
<div className="flex flex-row flex-wrap sm:flex-nowrap w-full bg-gray-100 shadow p-2 sm:p-4 rounded gap-4">
217+
<div className="w-full sm:w-2/6 relative">
218+
<span className="w-2/5 sm:hidden inline-block">Title :</span>
219+
<div className="w-3/5 sm:w-full inline-block">
220+
<InputField
221+
name="title"
222+
placeholder="Question Title"
223+
value={this.props.question.title}
224+
type="text"
225+
onChange={(event) => this.props.onChange(event, this.props.index)}
226+
/>
227+
</div>
228+
</div>
229+
<div className="w-full sm:w-2/6 relative">
230+
<span className="w-2/5 sm:hidden inline-block">Description :</span>
231+
<div className="w-3/5 sm:w-full inline-block">
232+
<InputField
233+
name="description"
234+
placeholder="Question Description"
235+
value={this.props.question.description}
236+
type="text"
237+
onChange={(event) => this.props.onChange(event, this.props.index)}
238+
/>
239+
</div>
240+
</div>
241+
<div className="w-full sm:w-1/6 relative">
242+
<span className="w-2/5 sm:hidden inline-block">Type :</span>
243+
<div className="w-3/5 sm:w-full inline-block">
244+
<ListboxInput
245+
array={types}
246+
value={this.props.question.data_type}
247+
onChange={(type) => this.props.onChange(type, this.props.index)}
248+
/>
249+
</div>
250+
</div>
251+
<div className="w-full sm:w-1/6 relative">
252+
<span className="w-2/5 sm:hidden inline-block">Order :</span>
253+
<div className="w-3/5 sm:w-full inline-block">
254+
<button
255+
type="button"
256+
className="btn bg-red-500 hover:bg-red-700 focus:bg-red-900"
257+
onClick={() => this.props.onDelete(this.props.index)}
258+
>
259+
Delete
260+
</button>
261+
</div>
262+
</div>
263+
</div>
254264
);
255265
}
256266
}
@@ -284,7 +294,7 @@ class InputField extends Component {
284294

285295
function ListboxInput(props) {
286296
return (
287-
<div className="w-32">
297+
<div className="w-auto">
288298
<Listbox value={props.value} onChange={props.onChange}>
289299
<div className="relative">
290300
<Listbox.Button className="relative w-full py-2 pl-3 pr-10 text-left bg-white rounded-lg shadow-md cursor-default focus:outline-none focus-visible:ring-2 focus-visible:ring-opacity-75 focus-visible:ring-white focus-visible:ring-offset-orange-300 focus-visible:ring-offset-2 focus-visible:border-indigo-500 sm:text-sm">

0 commit comments

Comments
 (0)