Skip to content
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 | Zeliha Pala | Full-Stack-Project-Assessment | week-2 |update embed videos #42

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/src/NewVideoForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@

.input-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
}

.submit-button {
Expand Down
4 changes: 4 additions & 0 deletions client/src/VideoRecommendations.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@
.video-title a:hover {
text-decoration: underline;
}
.video-item iframe {
width: 100%; /* İframe'in genişliğini % olarak ayarlayın */
height: 100%; /* İframe'in yüksekliğini % olarak ayarlayın */
}
46 changes: 31 additions & 15 deletions client/src/VideoRecommendations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "./VideoRecommendations.css";
import DeleteVideoRecommendation from "./DeleteVideoRecommendation";
import NewVideoForm from "./NewVideoForm.jsx";
import RatingDisplay from "./RatingDisplay.jsx";

const VideoList = () => {
const [videos, setVideos] = useState([]);

Expand Down Expand Up @@ -37,25 +38,40 @@ const VideoList = () => {
setVideos(updatedVideos);
};

function changeYTLinkToEmbed(watchLink) {
return watchLink.replace("watch?v=", "embed/");
}

return (
<div className="video-list-container">
<div className="video-list">
{videos.map((videoData, i) => (
<div className="video-item" data-testid="video" key={i}>
<div className="video-title">
<a href={videoData.src}>{videoData.title}</a>
{videos.map((videoData, i) => {
const embedLink = changeYTLinkToEmbed(videoData.src);
return (
<div className="video-item" data-testid="video" key={i}>
<div className="video-title">{videoData.title}</div>
<div className="video-frame">
<iframe
title={videoData.title}
width="560"
height="315"
src={embedLink}
frameBorder="0"
allowFullScreen
></iframe>
</div>
<DeleteVideoRecommendation
videoId={videoData.id}
onDelete={handleDelete}
/>
<RatingDisplay
videoId={videoData.id}
rating={videoData.rating}
onUpdate={handleRatingUpdate}
/>
</div>
<DeleteVideoRecommendation
videoId={videoData.id}
onDelete={handleDelete}
/>
<RatingDisplay
videoId={videoData.id}
rating={videoData.rating}
onUpdate={handleRatingUpdate}
/>
</div>
))}
);
})}
</div>
<NewVideoForm onSubmit={fetchVideos} />
</div>
Expand Down
Loading