forked from CodeYourFuture/Full-Stack-Project-Assessment
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NW6 | Rabia Avci | Full-Stack-Project | Week-2 | New video form #26
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b1d7768
add new video form and completed fetch
RbAvci 8b23a18
add css for new video form
RbAvci 055bd82
fixed prettier for css
RbAvci 34f9123
added useState to handle inputs
RbAvci 046903f
Merge branch 'main' into RB/New_video_form
RbAvci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* CSS for NewVideoForm component */ | ||
div { | ||
max-width: 500px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
border: 1px solid #ccc; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
background-color: #f9f9f9; | ||
} | ||
|
||
h2 { | ||
text-align: center; | ||
color: #333; | ||
margin-bottom: 20px; | ||
} | ||
|
||
form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 15px; | ||
} | ||
|
||
div > div { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
label { | ||
font-weight: bold; | ||
margin-bottom: 5px; | ||
color: #555; | ||
} | ||
|
||
input { | ||
padding: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
font-size: 16px; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
border: none; | ||
border-radius: 5px; | ||
background-color: #007bff; | ||
color: #fff; | ||
font-size: 16px; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always nice to have a hover style for buttons. Overall, I really like what you're doing here, good use of flex and nice touches like border-radius and padding in inputs throughtout |
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React, { useState } from "react"; | ||
|
||
import "./NewVideoForm.css"; | ||
const NewVideoForm = () => { | ||
const [title, setTitle] = useState(""); | ||
const [src, setSrc] = useState(""); | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
|
||
fetch("/api/videos", { | ||
method: "POST", | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ title, src }), | ||
}) | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
console.log(JSON.stringify(data)); | ||
}) | ||
.catch((error) => { | ||
console.error(error); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h2>Add New Video</h2> | ||
<form onSubmit={handleSubmit}> | ||
<div> | ||
<label htmlFor="title">Video Title: </label> | ||
<input | ||
type="text" | ||
id="title" | ||
value={title} | ||
onChange={(e) => setTitle(e.target.value)} | ||
required | ||
/> | ||
</div> | ||
<div> | ||
<label htmlFor="src">Video URL: </label> | ||
<input | ||
type="url" | ||
id="src" | ||
value={src} | ||
onChange={(e) => setSrc(e.target.value)} | ||
required | ||
/> | ||
</div> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NewVideoForm; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason you're setting the cursor to pointer here? It should be pointer by default here https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When its default it keeps an arrow, i wanted to make it a hand icon when hovering over the element :)