Skip to content

Commit 4c2dbad

Browse files
authored
🍁 [Frontend] improve "ask your question" ui (#925)
* changed "ask your question ui" * reverted changes
1 parent 8836396 commit 4c2dbad

File tree

4 files changed

+76
-22
lines changed

4 files changed

+76
-22
lines changed

β€Žfrontend/src/pages/Q&A/Q&A.jsx

+19-11
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ function Ques(props) {
124124
body: JSON.stringify(formdata),
125125
});
126126
const data = await response.json();
127-
if(data.errStack){
127+
if (data.errStack) {
128128
setToastMessage(`${data.errStack}`);
129129
setOpenToast(true);
130130
setSeverity("error");
131-
}else{
131+
} else {
132132
setToastMessage("Q&A added successfully!");
133133
setOpenToast(true);
134134
setSeverity("success");
135135
}
136136
setIsUploadingData(false);
137-
137+
138138
setFormData({
139139
title: "",
140140
description: "",
@@ -385,7 +385,11 @@ function Ques(props) {
385385
? `mb-3 ${style["level-of-trust"]} ${style["level-of-trust-dark"]}`
386386
: `mb-3 ${style["level-of-trust"]} ${style["level-of-trust-dark"]}`
387387
}
388-
style={{ color: "#69a9dd", fontSize: "25px" }}
388+
style={{
389+
color: "#69a9dd",
390+
fontSize: "25px",
391+
textAlign: "center",
392+
}}
389393
>
390394
Tags
391395
</label>
@@ -425,15 +429,19 @@ function Ques(props) {
425429

426430
<div
427431
className={style["submit-btn"]}
428-
style={{ justifyContent: "space-around" }}
432+
style={{ justifyContent: "space-around", marginBottom: "1rem" }}
429433
>
430434
<div className="data-loader">
431-
{isUploadingData ? <Loader /> : <Button2
432-
style={{ marginRight: "3%" }}
433-
className={style["submit-btn-text"]}
434-
label="Submit"
435-
type="submit"
436-
/>}
435+
{isUploadingData ? (
436+
<Loader />
437+
) : (
438+
<Button2
439+
style={{ marginRight: "3%" }}
440+
className={style["submit-btn-text"]}
441+
label="Submit"
442+
type="submit"
443+
/>
444+
)}
437445
</div>
438446
</div>
439447
</div>

β€Žfrontend/src/pages/Q&A/Ques.scss

+33-7
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,35 @@
44
}
55

66
.question_form {
7+
padding: 2rem;
78
width: 50%;
89
border: 2px solid #2a4886;
9-
border-radius: 7px;
10-
margin: 5% 5% 5% 25%;
10+
border-radius: 1rem;
11+
margin: 5rem auto;
12+
display: flex;
13+
flex-direction: column;
14+
justify-content: center;
15+
align-items: center;
16+
align-content: center;
1117
}
1218

1319
.close-popup {
14-
position: relative;
15-
margin-top: 1%;
16-
background: black;
17-
color: #69a9dd;
20+
color: black;
21+
background: #69a9dd;
1822
margin-left: 96.5%;
1923
width: 25px;
2024
height: 25px;
2125
border-radius: 50%;
22-
border: 1px solid #69a9dd;
26+
border: none;
27+
}
28+
29+
.toppings-list {
30+
display: grid;
31+
grid-template-columns: repeat(4, 1fr);
32+
grid-gap: 2rem;
33+
li {
34+
width: 8rem;
35+
}
2336
}
2437

2538
.question-cards {
@@ -75,6 +88,19 @@
7588
cursor: pointer;
7689
}
7790

91+
@media screen and (max-width: 1200px) {
92+
.toppings-list {
93+
grid-template-columns: repeat(2, 1fr);
94+
}
95+
}
96+
97+
@media (max-width: 650px) {
98+
.question_form {
99+
width: 85%;
100+
margin: auto;
101+
}
102+
}
103+
78104
@media (max-width: 650px) {
79105
.question_form {
80106
width: 85%;

β€Žfrontend/src/pages/Resources/components/ResourceSharingForm/ResourceSharingForm.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import { SimpleToast } from "../../../../components/util/Toast";
99

1010
export function ResourceSharingForm(props) {
1111
const [resourceToast, setResourceToast] = useState("");
12-
const [openSubmitResourceSuccess, setOpenSubmitResourceSuccess] = useState(
13-
false
14-
);
12+
const [openSubmitResourceSuccess, setOpenSubmitResourceSuccess] =
13+
useState(false);
1514
const [isLoading, setIsLoading] = useState(false);
1615
const [resourceToastStatus, setResourceToastStatus] = useState("");
1716

β€Žfrontend/src/pages/Resources/components/ResourceSharingForm/resource-sharing-form.module.scss

+22-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
.resource-input {
8282
position: relative;
8383
margin-bottom: 30px !important;
84+
width: 35rem;
8485
}
8586

8687
.resource-input input,
@@ -217,8 +218,11 @@
217218
}
218219

219220
.inside-resource {
221+
display: flex;
222+
flex-direction: column;
223+
justify-content: center;
224+
align-items: center;
220225
width: 85%;
221-
margin: 0 auto;
222226
}
223227

224228
[type="radio"] {
@@ -354,6 +358,23 @@ input[type="date"]:not(:valid):before {
354358
align-items: center;
355359
}
356360

361+
@media screen and (max-width: 1200px) {
362+
.resource-input {
363+
width: 23rem;
364+
}
365+
366+
.toppings-list {
367+
display: flex;
368+
grid-template-columns: repeat(2, 1fr);
369+
}
370+
}
371+
372+
@media screen and (max-width: 750px) {
373+
.resource-input {
374+
width: auto;
375+
}
376+
}
377+
357378
@media screen and (max-width: 750px) {
358379
.resource-section {
359380
flex-direction: column;

0 commit comments

Comments
Β (0)