Skip to content

Commit 8df25d8

Browse files
authored
Merge pull request #16 from CS3219-AY2425S1/reorder-form-fields
Minor updates on UI
2 parents 72384ee + 9f6f182 commit 8df25d8

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

Frontend/src/components/question/CreateQn.jsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,21 @@ function CreateQn({handleClose, addQuestion}) {
3535

3636
return (
3737
<div className='d-flex bg-primary justify-content-center align-items-center'>
38-
<div className="w-100 bg-white p-3">
38+
<div className="w-100 bg-white px-3 pb-3">
3939
<form onSubmit={Submit}>
4040
{error && <div className="alert alert-danger">{error}</div>}
41+
<div className="mb-2">
42+
<label htmlFor="">Title</label>
43+
<input type="text" placeholder='Shortest Distance' className='form-control'
44+
onChange={(e) => setTitle(e.target.value)}/>
45+
</div>
4146
<div className="mb-2">
4247
<label htmlFor="">Category</label>
4348
<input type="text" placeholder='Data Structures' className='form-control'
4449
onChange={(e) => setCategory(e.target.value.split(","))}/>
4550
</div>
46-
<div className="container mt-3">
47-
<h3>Complexity</h3>
51+
<div className="container my-3">
52+
<h5>Complexity</h5>
4853
<div className="form-check">
4954
<input type="radio" id="easy" value="Easy" name={"complexity"}
5055
onChange={(e) => setComplexity(e.target.value)}/>
@@ -61,16 +66,12 @@ function CreateQn({handleClose, addQuestion}) {
6166
<label className="form-check-label" htmlFor="hard">Hard</label>
6267
</div>
6368
</div>
64-
<div className="mb-2">
69+
<div className="mb-3">
6570
<label htmlFor="">Description</label>
6671
<input type="text" placeholder='Return the largest....' className='form-control'
6772
onChange={(e) => setDescription(e.target.value)}/>
6873
</div>
69-
<div className="mb-2">
70-
<label htmlFor="">Title</label>
71-
<input type="text" placeholder='Shortest Distance' className='form-control'
72-
onChange={(e) => setTitle(e.target.value)}/>
73-
</div>
74+
7475
<button className="btn btn-success">Submit</button>
7576
</form>
7677
</div>

Frontend/src/components/question/EditQn.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,21 @@ function EditQn({ question, handleClose, editQuestion }) {
4545

4646
return (
4747
<div className='d-flex bg-primary justify-content-center align-items-center'>
48-
<div className="w-100 bg-white p-3">
48+
<div className="w-100 bg-white px-3 pb-3">
4949
<form onSubmit={Update}>
50-
<h2>Update Question</h2>
5150
{error && <div className="alert alert-danger">{error}</div>}
51+
<div className="mb-2">
52+
<label htmlFor="">Title</label>
53+
<input type="text" placeholder='Shortest Distance' className='form-control'
54+
value={title} onChange={e => setTitle(e.target.value)}/>
55+
</div>
5256
<div className="mb-2">
5357
<label htmlFor="">Category</label>
5458
<input type="text" placeholder='Data Structures' className='form-control'
5559
value={category.join(",")} onChange={(e) => setCategory(e.target.value.split(","))}/>
5660
</div>
57-
<div className="container mt-3">
58-
<h3>Complexity</h3>
61+
<div className="container my-3">
62+
<h5>Complexity</h5>
5963
<div className="form-check">
6064
<input type="radio" id="easy" value="Easy" checked={complexity === "Easy"} onChange={(e) => setComplexity(e.target.value)}/>
6165
<label className="form-check-label" htmlFor="easy">Easy</label>
@@ -69,16 +73,12 @@ function EditQn({ question, handleClose, editQuestion }) {
6973
<label className="form-check-label" htmlFor="hard">Hard</label>
7074
</div>
7175
</div>
72-
<div className="mb-2">
76+
<div className="mb-3">
7377
<label htmlFor="">Description</label>
7478
<input type="text" placeholder='Return the largest....' className='form-control'
7579
value={description} onChange={(e) => setDescription(e.target.value)}/>
7680
</div>
77-
<div className="mb-2">
78-
<label htmlFor="">Title</label>
79-
<input type="text" placeholder='Shortest Distance' className='form-control'
80-
value={title} onChange={e => setTitle(e.target.value)}/>
81-
</div>
81+
8282
<button className="btn btn-success">Update</button>
8383
</form>
8484
</div>

Frontend/src/components/question/Question.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useState, useEffect } from 'react';
2-
import { Link } from 'react-router-dom';
32
import Modal from "react-bootstrap/Modal";
43
import Table from "react-bootstrap/Table";
54
import ButtonGroup from "react-bootstrap/ButtonGroup";
@@ -14,8 +13,7 @@ function Question() {
1413
const [questionToDelete, setQuestionToDelete] = useState(null);
1514
const [showEditModal, setShowEditModal] = useState(false);
1615
const [currentQuestion, setCurrentQuestion] = useState(null);
17-
const [error, setError] = useState("")
18-
16+
1917
const handleShow = () => setShowComponent(true);
2018
const handleClose = () => setShowComponent(false);
2119

@@ -50,7 +48,6 @@ function Question() {
5048

5149
const handleCloseEditModal = () => {
5250
setShowEditModal(false);
53-
setError("");
5451
}
5552

5653
// Show the delete confirmation modal

0 commit comments

Comments
 (0)