Skip to content

Commit

Permalink
Embed Video Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
zelihapala committed May 26, 2024
1 parent baef03d commit f9089a2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
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

0 comments on commit f9089a2

Please sign in to comment.