import React from "react";
import axios from "axios";
class App extends React.Component {
state = {
isLoading: true,
movies: []
};
getMovies = async () => {
const movies = await axios.get("https://yts-proxy.now.sh/list_movies.json");
};
componentDidMount() {
setTimeout(() => {
this.setState({ isLoading: false });
}, 6000);
this.getMovies();
}
render() {
const { isLoading } = this.state;
map 함수 꼭 리턴해주기. object를 풀어줄 때 map사용. jsx에서 props를 통해 값 전달. key는 표현되지 않지만 필수 props이다.
import React from "react";
import axios from "axios";
import Movie from "./Movie";
import "./App.css";
class App extends React.Component {
state = {
@@ -23,10 +24,14 @@ class App extends React.Component {
render() {
const { isLoading, movies } = this.state;
return (
<div>
{isLoading
? "Loading..."
: movies.map(movie => (
<section class="container">
{isLoading ? (
<div class="loader">
<span class="loader__text">Loading...</span>
</div>
) : (
<div class="movies">
{movies.map(movie => (
<Movie
key={movie.id}
id={movie.id}
@@ -36,7 +41,9 @@ class App extends React.Component {
poster={movie.medium_cover_image}
/>
))}
</div>
</div>
)}
</section>
);
}
}
import React from "react";
import PropTypes from "prop-types";
import "./Movie.css";
function Movie({ id, year, title, summary, poster }) {
return <h4>{title}</h4>;
function Movie({ year, title, summary, poster }) {
return (
<div class="movie">
<img src={poster} alt={title} title={title} />
<div class="movie__data">
<h3 class="movie__title">{title}</h3>
<h5 class="movie__year">{year}</h5>
<p class="movie__summary">{summary}</p>
</div>
</div>
);
}
Movie.propTypes = {
id: PropTypes.number.isRequired,
year: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
summary: PropTypes.string.isRequired,
poster: PropTypes.string.isRequired
};
export default Movie;
.movies .movie {
width: 45%;
background-color: white;
margin-bottom: 70px;
display: flex;
align-items: flex-start;
justify-content: space-between;
font-weight: 300;
padding: 20px;
border-radius: 5px;
color: #adaeb9;
box-shadow: 0 13px 27px -5px rgba(50, 50, 93, 0.25),
0 8px 16px -8px rgba(0, 0, 0, 0.3), 0 -6px 16px -6px rgba(0, 0, 0, 0.025);
}
.movie img {
position: relative;
top: -50px;
max-width: 150px;
width: 100%;
margin-right: 30px;
box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.25),
0 18px 36px -18px rgba(0, 0, 0, 0.3), 0 -12px 36px -8px rgba(0, 0, 0, 0.025);
}
.movie .movie__title,
.movie .movie__year {
margin: 0;
font-weight: 300;
}
.movie .movie__title {
margin-bottom: 5px;
font-size: 24px;
color: #2c2c2c;
}
.movie .movie__genres {
list-style: none;
padding: 0;
margin: 0;
display: flex;
margin: 5px 0px;
}
.movie__genres li,
.movie .movie__year {
margin-right: 10px;
font-size: 14px;
}
Creating a movie app involves meticulous planning, user-centric design, and seamless functionality. Integrating features like Cinema APK Firestick enhances accessibility and user experience, allowing effortless streaming on Firestick devices. The journey of developing such an app is multifaceted, from conceptualizing the interface to ensuring compatibility across platforms. As the project culminates, evaluating user feedback becomes crucial for refining and enhancing the app's performance. In conclusion, the process of making a movie app, especially with features like Cinema APK Firestick, demands technical finesse and a deep understanding of user preferences. Continuous iterations and user-driven enhancements mark the path toward a successful and engaging movie-streaming platform.