Skip to content

Commit

Permalink
Project Form updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaditya019Jain committed Oct 12, 2023
1 parent 32db31d commit a9a53ed
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
12 changes: 12 additions & 0 deletions frontend/src/components/MyComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import './comments.css';

export default function MyComponent(props){
return(
<div className="searchbar">
<p>
{props.text}
</p>
</div>
)
}
8 changes: 8 additions & 0 deletions frontend/src/components/MyComponent2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import './comments.css';

export default function MyComponent2(){
return(
<p>No Match Found</p>
)
}
21 changes: 13 additions & 8 deletions frontend/src/components/ProjectFrom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from "react";
import axios from "axios";
import { useState } from "react";
import MyComponent from "./MyComponent";
import MyComponent2 from "./MyComponent2";



export default function ProjectForm(){
Expand All @@ -18,25 +21,25 @@ export default function ProjectForm(){

const handleChange = (e) => {
const {id,value} = e.target;
console.log(roll_number)
// console.log(roll_number)
setRoll_number((prevRoll_number) => ({
...prevRoll_number,
[id]: value,
}));
}

// const [toggle,setToggle] = useState(false)
// const [anyone,setAnyone] = useState(false)

const handleSubmit = (e) => {
// console.log(roll_number)
e.preventDefault();
axios.get('/api/accounts/',roll_number)
.then( function(roll_number){
// console.log(roll_number)
if(roll_number.status === 200){
console.log(roll_number,"found")
}
console.log(roll_number.data[0].roll_number)
})
.catch( err =>{

alert(err);
})
}
return (
Expand All @@ -47,11 +50,14 @@ export default function ProjectForm(){
<input type='text' />
<br></br>
<label>
<input id='roll_number' onChange={handleChange} />
<input id='roll_number' type='search' />
<button onClick={handleSubmit}>
Search
</button>
{/* {toggle && <MyComponent text="roll_number"/>} */}
{/* {anyone && <MyComponent2 />} */}
</label>

<br></br>
<label>
Title your project idea
Expand Down Expand Up @@ -86,7 +92,6 @@ export default function ProjectForm(){
</label>
<br></br>
<br></br>

</div>
<label>
<input type='text'/>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/comments.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
margin-left: 16px;
margin-right: 16px;
}

.searchbar{
background-color: white;
height:auto ;
width: auto;
}

0 comments on commit a9a53ed

Please sign in to comment.