diff --git a/src/app/results/Channel.tsx b/src/app/results/Channel.tsx index aa4d407..16b64de 100644 --- a/src/app/results/Channel.tsx +++ b/src/app/results/Channel.tsx @@ -1,3 +1,5 @@ +"use client"; + import { Component } from "@/typings/component"; import { ChannelResult as ChannelProps } from "@/client/typings/search"; diff --git a/src/app/results/Playlist.tsx b/src/app/results/Playlist.tsx new file mode 100644 index 0000000..3a91f02 --- /dev/null +++ b/src/app/results/Playlist.tsx @@ -0,0 +1,71 @@ +"use client"; + +import { PlaylistResult as PlaylistProps } from "@/client/typings/search"; +import { Component } from "@/typings/component"; +import { Card, CardBody } from "@nextui-org/card"; +import { Image } from "@nextui-org/image"; +import NextLink from "next/link"; +import NextImage from "next/image"; +import { useMemo } from "react"; +import { Link } from "@nextui-org/link"; + +export const Playlist: Component<{ data: PlaylistProps }> = ({ data }) => { + const url = `/playlist/${data.id}`; + const channelUrl = `/channel/${data.author.id}`; + + const videoSize = 200; + const aspectRatio = 16 / 9; + + const [width, height] = useMemo(() => { + return [videoSize * aspectRatio, videoSize]; + }, [videoSize]); + + return ( + + + +
+
+ {data.title} +

+ {data.numberOfVideos} videos +

+
+ +
+
+

{data.title}

+ + +

+ {data.author.name} +

+ +
+ + {data.videos && ( +
+ {data.videos.map((video) => { + return

{video.title}

; + })} +
+ )} +
+
+
+
+
+ ); +}; diff --git a/src/app/results/Search.tsx b/src/app/results/Search.tsx index b22bf7f..e3676e4 100644 --- a/src/app/results/Search.tsx +++ b/src/app/results/Search.tsx @@ -11,6 +11,7 @@ import { Container } from "@/components/Container"; import { LoadingPage } from "@/components/LoadingPage"; import { Button } from "@nextui-org/button"; import { Video } from "./Video"; +import { Playlist } from "./Playlist"; export const Search: Component = () => { const searchParams = useSearchParams(); @@ -60,8 +61,8 @@ export const Search: Component = () => { case "video": return