INIT(app): initial commit
- Initialize project structure - Add base configuration
This commit is contained in:
29
services/nextjs/components/movie-info.tsx
Normal file
29
services/nextjs/components/movie-info.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import styles from "../styles/movie-info.module.css";
|
||||
|
||||
const URL = "https://nomad-movies.nomadcoders.workers.dev/movies";
|
||||
|
||||
export async function getMovie(id: string) {
|
||||
const response = await fetch(`${URL}/${id}`);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
export default async function MovieInfo({ id }: { id: string }) {
|
||||
const movie = await getMovie(id);
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<img
|
||||
src={movie.poster_path}
|
||||
className={styles.poster}
|
||||
alt={movie.title}
|
||||
/>
|
||||
<div className={styles.info}>
|
||||
<h1 className={styles.title}>{movie.title}</h1>
|
||||
<h3>*{movie.vote_average.toFixed(1)}</h3>
|
||||
<p>{movie.overview}</p>
|
||||
<a href={movie.homepage} target={"_blank"}>
|
||||
Homepage →
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user