Giter Club home page Giter Club logo

another-movie-database's Introduction

AMDB - Another movie database ๐ŸŽฅ

Movie database app made with React.js. Part of course submission for JSBE at ECUtbildning 2022.

Preview on Netlify: anothermoviedatabase.netlify.app

Using data from themoviedb.org/documentation/api


๐Ÿ’ฟ Running the app locally:

Start with cloning this repo on your local machine:

$ git clone https://github.com/simon-off/another-movie-database.git
$ cd another-movie-database

Then run this to install all necessary dependencies:

$ npm install

Then you need to provide your own TMDB API Key:

1. Rename the "sample.env" file to: ".env.local"
2. Add your own api key where it says: "YourKeyHere"

Then simply start your local app instance by running!

$ npm start

Process

The design is heavily inspired by IMDb and JustWatch. It consists of 2 pages: Home and Movie. The latter is where you go when you click on a specific movie in either one of the carousels or in the search results.

One of the biggest struggles with this app was the carousel. I looks deceptively simple! It took quite some finagling to get the css and react to play nice. I use media queries in the css to set a custom property --columns to different values depending on screen width. I then get the value of this in my movieListSection component. With this value I can calculate the necessary things in order to scroll to the right card when the user clicks on of the two buttons (left and right). I do this by getting the id of the target card and using the .scrollIntoView() method on it. It feels a tad bit too involved but works quite well and you can still scroll horizontally like normal if you prefer!

I use a couple of custom hooks to help with some utility functions in the app:

  • useLocalStorage.jsx is a simple useState hook that makes sure the data is fetched on load (if present) and saved to local storage whenever it's updated.
  • useFetch.jsx is a cookie cutter fetch function that returns state variables for data, loading and error.
  • useSearchFetch.jsx is the same as useFetch except that it also takes in a query string that gets concatenated to the url and the fetch is called again whenever the value of the query string changes.

Otherwise there's not that much to say. A pretty standard movie app made that helped me learn a lot about the ins and outs of React. Coming from vanilla JavaScript the declarative programming style in react took some "unlearning" of vanilla js in order to get up and running. But once you wrap your head around state and the connection between components it's a whole lotta fun! ๐Ÿค“


Built With

Vite | React | React Router | Sass

Built by

Simon

another-movie-database's People

Contributors

simon-off avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.