Skip to content

Commit

Permalink
fix: video channel display
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayana62 committed Feb 12, 2024
1 parent 9990eb6 commit 858089e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
43 changes: 22 additions & 21 deletions src/components/SearchResultsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,30 @@ const SearchResultsContainer = ({ video }) => {
to={"/watch?v=" + video?.id?.videoId}
key={video.id.videoId || video.id.channelId || video.id.playlistId}
>
{video?.id?.kind !== "youtube#playlist" && (
<div className="flex flex-col sm:flex-row gap-2 relative">
<img
src={video?.snippet?.thumbnails?.medium?.url}
alt="thumbnail"
className={` mb-5 ${
video?.id?.kind === "youtube#channel"
? "rounded-full w-full sm:w-2/12 h-[12rem] mx-[5rem]"
: "rounded-xl w-full sm:w-4/12 h-[12rem]"
}`}
/>
<div className="w-full sm:w-8/12">
<h2 className=" text-lg">{video?.snippet?.title}</h2>
<p className=" text-[14px] text-[#606060] ml-1">
{moment(video?.snippet?.publishedAt).fromNow()}
</p>
<div className=" my-4">
<Channel channelId={video?.snippet?.channelId} />
{video?.id?.kind !== "youtube#playlist" &&
video?.id?.kind !== "youtube#channel" && (
<div className="flex flex-col sm:flex-row gap-2 relative">
<img
src={video?.snippet?.thumbnails?.medium?.url}
alt="thumbnail"
className={` mb-5 ${
video?.id?.kind === "youtube#channel"
? "rounded-full w-full sm:w-2/12 h-[12rem] mx-[5rem]"
: "rounded-xl w-full sm:w-4/12 h-[12rem]"
}`}
/>
<div className="w-full sm:w-8/12">
<h2 className=" text-lg">{video?.snippet?.title}</h2>
<p className=" text-[14px] text-[#606060] ml-1">
{moment(video?.snippet?.publishedAt).fromNow()}
</p>
<div className=" my-4">
<Channel channelId={video?.snippet?.channelId} />
</div>
<p className=" text-xs my-4">{video?.snippet?.description}</p>
</div>
<p className=" text-xs my-4">{video?.snippet?.description}</p>
</div>
</div>
)}
)}
</Link>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const OFFSET_LIVE_CHAT = 20;
export const OFFSET_SCROLL = 15;

export const YOUTUBE_VIDEOS_API =
"https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular&maxResults=6&pageToken=%PAGE_TOKEN%&regionCode=IN&key=" +
"https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular&maxResults=9&pageToken=%PAGE_TOKEN%&regionCode=IN&key=" +
process.env.REACT_APP_API_KEY;

export const YOUTUBE_SUGGESTED_VIDEOS_API =
Expand Down

0 comments on commit 858089e

Please sign in to comment.