Skip to content

Commit ce309cd

Browse files
authored
Merge pull request #58 from CS3219-AY2425S1/multiline-ui-desc
Update UI
2 parents b85ab13 + d825d36 commit ce309cd

File tree

4 files changed

+56
-9
lines changed

4 files changed

+56
-9
lines changed

Frontend/package-lock.json

Lines changed: 34 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Frontend/src/components/question/CreateQn.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,13 @@ function CreateQn({ handleClose, addQuestion }) {
221221

222222
<div className="mb-3">
223223
<label htmlFor="">Description</label>
224-
<input type="text" placeholder='Return the largest....' className='form-control'
225-
onChange={(e) => setDescription(e.target.value)} />
224+
<textarea
225+
placeholder="Return the largest..."
226+
className="form-control"
227+
style={{ height: '100px', resize: 'none' }} // Fixed height of 100px, remove "resize: none" if you want to allow resizing
228+
onChange={(e) => setDescription(e.target.value)}
229+
value={description} // Assuming `description` is the state variable holding the value
230+
/>
226231
</div>
227232

228233
<button className="btn btn-success">Submit</button>

Frontend/src/components/question/DetailQn.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ function DetailQn({ question, handleClose }) {
4646
<div className="mb-3">
4747
<b>Description</b>
4848
<div className="mt-1">
49-
<p>{description}</p>
49+
<p>
50+
{description.split('\n').map((line, index) => (
51+
<React.Fragment key={index}>
52+
{line}
53+
<br />
54+
</React.Fragment>
55+
))}
56+
</p>
5057
</div>
5158
</div>
5259
</div>

Frontend/src/components/question/EditQn.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,13 @@ function EditQn({ question, handleClose, editQuestion }) {
213213
</div>
214214
<div className="mb-3">
215215
<label htmlFor="">Description</label>
216-
<input type="text" placeholder='Return the largest....' className='form-control'
217-
value={description} onChange={(e) => setDescription(e.target.value)}/>
216+
<textarea
217+
placeholder="Return the largest...."
218+
className="form-control"
219+
value={description}
220+
onChange={(e) => setDescription(e.target.value)}
221+
style={{ height: '100px', resize: 'none' }} // Set a fixed height; adjust as needed
222+
/>
218223
</div>
219224

220225
<button className="btn btn-success">Update</button>

0 commit comments

Comments
 (0)