Skip to content

Commit de83ba0

Browse files
author
Aishwarya Nair
committed
add question form
1 parent 5b40cf0 commit de83ba0

File tree

6 files changed

+155
-3
lines changed

6 files changed

+155
-3
lines changed

peer-prep/src/App.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import './App.css';
2-
import { LoginSignUp } from './Components/LoginSignUp/LoginSignUp';
2+
//import { LoginSignUp } from './Components/LoginSignUp/LoginSignUp';
33
import { Navbar } from './Components/Navbar/Navbar';
4+
import { Questions } from './Components/Questions/Questions';
45

56
function App() {
67
return (
78
<div>
89
<Navbar/>
9-
<LoginSignUp/>
10+
{/*<LoginSignUp/>*/}
11+
<Questions/>
12+
1013
</div>
1114
);
1215
}

peer-prep/src/Components/Navbar/Navbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './Navbar.css'
44
export const Navbar = () => {
55
return (
66
<nav className = "nav">
7-
<a href = "#" className = "logo"> <span>&lt;Peer/</span> Prep&gt;</a>
7+
<a href = "#" className = "logo"> <span>&lt;Peer/</span>Prep&gt;</a>
88
</nav>
99
)
1010
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.container {
2+
display: flex;
3+
flex-direction: column;
4+
margin: auto;
5+
margin-top: 30px;
6+
width: 500px;
7+
height: 300px;
8+
background: #e9e9e9;
9+
padding: 30px 20px;
10+
gap: 20px;
11+
border-radius: 5px;
12+
}
13+
14+
.q-header {
15+
display: flex;
16+
align-items: center;
17+
height: 60px;
18+
font-size: 25px;
19+
20+
}
21+
22+
.q-title {
23+
height: 30px;
24+
padding: 0.5rem 0.5rem;
25+
}
26+
27+
.q-tags {
28+
display: flex;
29+
align-items: center;
30+
gap: 10px;
31+
margin-left: 20px;
32+
}
33+
34+
.q-tag {
35+
width: 80px;
36+
height: 25px;
37+
border-radius: 5px;
38+
39+
}
40+
41+
.q-id {
42+
padding: 0.5rem 1rem;
43+
}
44+
.q-input {
45+
outline: none;
46+
border: none;
47+
background: #c9c9c9;
48+
padding: 0.5rem 0.5rem;
49+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
50+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
51+
sans-serif;
52+
}
53+
54+
.q-input::placeholder {
55+
color: #797979;
56+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
57+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
58+
sans-serif;
59+
}
60+
61+
.q-description {
62+
width: 400px;
63+
height: 250px;
64+
margin-left: 20px;
65+
}
66+
67+
68+
.submit-btn {
69+
display: flex;
70+
margin: auto;
71+
justify-content: center;
72+
align-items: center;
73+
width: 90px;
74+
height: 130px;
75+
color: #fff;
76+
background: #52CC65;
77+
border-radius: 5px;
78+
font-size: 19px;
79+
cursor: pointer;
80+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React, { useState } from 'react'
2+
import './QuestionForm.css'
3+
4+
5+
export const QuestionForm = ({qId}) => {
6+
return (
7+
<form className = "container">
8+
<div className="q-header">
9+
<div className="q-id">#{qId}</div>
10+
<input type="text" className="q-title q-input"
11+
placeholder='Question Title'/>
12+
</div>
13+
14+
<div className="q-tags">
15+
<input type="text" className="q-tag q-input" placeholder = 'Difficulty'/>
16+
<input type="text" className="q-tag q-input" placeholder = 'Topic'/>
17+
</div>
18+
<textarea type="text" className="q-description q-input"
19+
placeholder = "Question description"/>
20+
21+
<div className="submit-btn">Submit</div>
22+
23+
24+
</form>
25+
)
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.q-wrapper {
2+
display: flex;
3+
flex-direction: column;
4+
margin: auto;
5+
margin-top: 40px;
6+
width: 600px;
7+
background: #fff;
8+
padding-bottom: 30px;
9+
}
10+
11+
.add-q-btn {
12+
position: absolute;
13+
right: 30px;
14+
bottom: 30px;
15+
display: flex;
16+
justify-content: center;
17+
align-items: center;
18+
width: 150px;
19+
height: 60px;
20+
color: #fff;
21+
background: #52CC65;
22+
border-radius: 5px;
23+
font-size: 19px;
24+
cursor: pointer;
25+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React, { useState } from 'react'
2+
import { QuestionForm } from './QuestionForm'
3+
import './Questions.css'
4+
5+
export const Questions = () => {
6+
const [qId, setQId] = useState(0);
7+
const [isAddQ, setAddQ] = useState(false);
8+
return (
9+
<div className="q-wrapper">
10+
{isAddQ === false ? <div></div> : <QuestionForm qId = {qId}/>}
11+
<div className="add-q-btn" onClick = {() => {
12+
setQId(qId + 1);
13+
setAddQ(true);
14+
}}> Add question</div>
15+
</div>
16+
17+
)
18+
}

0 commit comments

Comments
 (0)