-
Notifications
You must be signed in to change notification settings - Fork 14
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
[6주차] Reddigg 미션 제출합니다. #16
base: master
Are you sure you want to change the base?
Changes from 1 commit
53decb6
a9080c0
8b3043d
f04e1db
b4924aa
d2d191d
c096392
37d627d
f272385
b2bc562
3b08625
311dfd8
86c4616
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import NavBar from "@/components/navbar"; | ||
import { BackgroundImg } from "@/components/ImageType"; | ||
import { getImageUrl } from "@/app/utils/movieFunctions"; | ||
import { PlayButton } from "@/components/Play"; | ||
import { useSearchParams } from "next/navigation"; | ||
type Props = {}; | ||
|
||
function MovieId({}: Props) { | ||
const searchParams = useSearchParams(); | ||
const backdrop_path = searchParams.get("path"); | ||
const overview = searchParams.get("overview"); | ||
|
||
return ( | ||
<div className="flex flex-col items-center justify-center"> | ||
{backdrop_path ? ( | ||
<BackgroundImg imageUrl={getImageUrl(backdrop_path)} /> | ||
) : null} | ||
<PlayButton /> | ||
|
||
<h3 className="pl-[0.25rem] text-white mt-[2rem] pl-[2rem] text-preview font-bold w-[375px]"> | ||
Previews | ||
</h3> | ||
<div className="text-custom-white text-explain mt-[1.5rem] px-[2rem] leading-[0.88rem] w-[375px]"> | ||
{overview} | ||
</div> | ||
<NavBar /> | ||
</div> | ||
); | ||
} | ||
|
||
export default MovieId; |
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. utils 함수에 render 관련 함수들을 모아준게 가독성이 좋습니다!! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { SquareImg, Previews, BackgroundImg } from "@/components/ImageType"; | ||
import { useEffect, useState, useMemo } from "react"; | ||
import { SquareForRankingIcon, Top10Icon } from "../../../public/svgs"; | ||
import Link from "next/link"; | ||
|
||
interface Movie { | ||
id: number; | ||
title: string; | ||
poster_path: string; | ||
backdrop_path: string; | ||
overview: string; | ||
} | ||
|
||
//페이지의 가장 위쪽에 랜덤으로 함수를 보여주는 함수 | ||
|
@@ -32,7 +35,14 @@ export const RandomMovie = ({ movies }: { movies: Movie[] }) => { | |
|
||
return movie ? ( | ||
<div className="flex flex-col items-center justify-center w-[100%]"> | ||
<BackgroundImg imageUrl={getImageUrl(movie.poster_path)} /> | ||
<Link | ||
href={{ | ||
pathname: `/movie-detail/${movie.id}`, | ||
query: { path: movie.backdrop_path, overview: movie.overview }, | ||
}} | ||
> | ||
<BackgroundImg imageUrl={getImageUrl(movie.poster_path)} /> | ||
</Link> | ||
<span className="flex align-center mt-2 md-2"> | ||
<div className="relative mr-2"> | ||
<SquareForRankingIcon /> | ||
|
@@ -50,7 +60,14 @@ export const RandomMovie = ({ movies }: { movies: Movie[] }) => { | |
export const renderRoundMovies = (movies: Movie[]) => { | ||
return movies.map((movie) => ( | ||
<div key={movie.id}> | ||
<Previews imageUrl={getImageUrl(movie.poster_path)} /> | ||
<Link | ||
href={{ | ||
pathname: `/movie-detail/${movie.id}`, | ||
query: { path: movie.backdrop_path, overview: movie.overview }, | ||
}} | ||
> | ||
Comment on lines
+72
to
+77
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.
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. as를 쓰니까 왜인지 useSearchParam이 읽지를 못하더라구요... ㅠㅠ 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. 저도 배워갑니다! |
||
<Previews imageUrl={getImageUrl(movie.poster_path)} /> | ||
</Link> | ||
</div> | ||
)); | ||
}; | ||
|
@@ -59,7 +76,14 @@ export const renderRoundMovies = (movies: Movie[]) => { | |
export const renderBoxMovies = (movies: Movie[]) => { | ||
return movies.map((movie) => ( | ||
<div key={movie.id}> | ||
<SquareImg imageUrl={getImageUrl(movie.poster_path)} /> | ||
<Link | ||
href={{ | ||
pathname: `/movie-detail/${movie.id}`, | ||
query: { path: movie.backdrop_path, overview: movie.overview }, | ||
}} | ||
> | ||
<SquareImg imageUrl={getImageUrl(movie.poster_path)} /> | ||
</Link> | ||
</div> | ||
)); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use client"; | ||
import styled from "styled-components"; | ||
import { MainPlayIcon } from "../../public/svgs"; | ||
|
||
export const PlayButton = () => { | ||
return ( | ||
<Button> | ||
<MainPlayIcon className="mr-[0.94rem]" /> | ||
<ButtonText>Play</ButtonText> | ||
</Button> | ||
); | ||
}; | ||
|
||
const Button = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 303px; | ||
height: 45px; | ||
display: flex; | ||
border-radius: 5.625px; | ||
margin-top: 0.81rem; | ||
background-color: #c4c4c4; | ||
&:hover { | ||
background-color: #a3a3a3; | ||
} | ||
`; | ||
|
||
const ButtonText = styled.span` | ||
color: #000000; | ||
text-align: center; | ||
font-size: 1.27rem; | ||
line-height: 146.61%; | ||
`; |
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.
Next에서 CSS적용할 때, SSR 방식으로 구현하는 점을 생각하면 Tailwind css 사용하는 게 제일 좋은 방법인 거 같아요:) 막상도입하는데 쉽지 않으셨을 거 같은데, 고생많으셨습니다!