GithubHelp home page GithubHelp logo

anujnegi157 / pokedex-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tiffanynk/pokedex-project

0.0 0.0 0.0 74 KB

Flatiron School | Mod2 Final | Rails and JavaScript

JavaScript 49.90% CSS 36.46% HTML 13.64%

pokedex-project's Introduction

Mod2 Project | Flatiron School

StorytellingPokedex

Our Pokedex is a webapp that utilizes Javascript, HTML, and CSS. Utilizing the PokeAPI, we created a Pokedex with the first Generation (Kanto) Pokemon. Our intention with this project was to work with a larger, more complex API and expand our knowledge on styling with CSS.

“It’s more important to master the cards you’re holding than to complain about the ones your opponent was dealt.” – Grimsley ⚡

Technologies

  • JavaScript
  • HTML5
  • CSS

Setup

To run this project, install it locally by cloning this GitHub repository and opening it in your code editor.

From there, navigate into the folder titled pokedex-frontend and run lite-server in your terminal.

This should prompt your browser to open a page at: localhost:3001

You are now ready to start using the first iteration of our Pokedex! Please see our features section to learn more!

Instructions

Once you have opened the project through lite-server, you can find all 151 First Generation Pokemon by either searching for its name or browsing Pokemon by type.

To clear your search results, just click Reset.

To see more information about a specific Pokemon, hover over its card and click on its name!

To navigate back to the homepage after being directed to an individual Pokemon page, please click the Pokeball at the top of the page.

Code Examples

Our initial fetch call for the main page:
const fetchPokemon = () => {
    const promises = [];
    for (let i = 1; i <= 151; i++) {
        const pokemonURL = `https://pokeapi.co/api/v2/pokemon/${i}`;
        promises.push(fetch(pokemonURL) 
            .then(response => response.json())
        )
    }
    Promise.all(promises)
    .then(allPokemon => {
        const firstGenPokemon = allPokemon.map(pokemon => ({
            frontImage: pokemon.sprites['front_default'],
            pokemon_id: pokemon.id,
            name: pokemon.name,
            type: pokemon.types[0].type.name,
            abilities: pokemon.abilities.map(ability => ability.ability.name).join(', '),
            backImage: pokemon.sprites['back_default'],
            description: pokemon.species.url
        }))
        pokemonArray = firstGenPokemon
        createPokemonCards(firstGenPokemon)
    })
    .then(generateTypes)
}

Creating elements for Pokemon descriptions after making a request to the PokeAPI:

function displayDetails(pokemonDetails) {
        const findDetailsContainer = document.querySelector(".details-container")
        const pokemonDescription = document.createElement('p');
        pokemonDescription.classList.add("description")
        pokemonDescription.textContent = `${pokemonDetails.flavor_text_entries[3].flavor_text}`

        findDetailsContainer.append(pokemonDescription)
    }

App Preview

Flip Pokemon Card Feature:

Flip Pokemon Card



Individual Pokemon Page:

Individual Pokemon Page



Filter Pokemon by Type:

Each Pokemon card is color coded according to its Pokemon Type!

Filter by Type Feature



Filter Pokemon by Name:

Filter by Name Feature



User Stories

As a user, you will be able to:

  1. See a list of all first generation Pokemon names and pictures.
  2. see the list of Pokemon name and picture as a Pokemon card.
  3. Click on a Pokemon and see a page of its information.
  4. Search for a Pokemon using its name
  5. See more information about a pokemon in the back of the card.

Status

We set out create a functional and aesthetically pleasing Pokedex.

With time, we would like to refactor our code and add features such as:

  • Adding Favorites
  • Creating User Log ins
  • Add Pokemon Ability descriptions.
  • Update Pokemon photos.
  • Add a button to navigate back to the top of the page.
  • Challenges

  • How to handle the pokémon data (store it in db, FE only, some combination)
  • Limiting the struggle cycle! Looking over each other's code when we were stuck proved to be incredibly helpful.
  • How to access information from different endpoints of the API.
  • How to remove duplicates and recreate Pokémon cards after the Name search
  • Contact

    Tiffany KanjanaboutTiffany Kanjanabout :octocat:
    Paige MilesPaige Miles 🌲

    API Reference

    [PokeAPI](https://pokeapi.co/)
    Icons made by Freepik from www.flaticon.com

    pokedex-project's People

    Contributors

    paigelucasmiles avatar tiffanynk avatar anujnegi157 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.