Giter Club home page Giter Club logo

pok-monapi's Introduction

Poke-monAPI

The Pokémon Display Web App is a simple, front-end web application that fetches and displays information about Pokémon using the PokéAPI. This project aims to provide a user-friendly interface where users can view details of various Pokémon, including their names and images.

Screenshot (38286)

Objectives

To create a web application that interacts with an external API (PokéAPI) to fetch data. To display Pokémon information in a visually appealing and responsive layout. To enhance understanding and skills in HTML, CSS, and JavaScript. To practice fetching and handling data from a RESTful API. Technologies Used HTML5: For the structure and layout of the web page. CSS3: For styling and responsive design. JavaScript: For fetching data from the PokéAPI and dynamically updating the web page. PokéAPI: A RESTful API providing Pokémon data.

Key Features

Fetch Pokémon Data: The application fetches data for the first 10 Pokémon using the PokéAPI. Dynamic Content Display: Pokémon names and images are dynamically inserted into the web page. Responsive Design: The application features a responsive design to ensure it looks good on various devices. Simple and Clean UI: The user interface is straightforward, making it easy for users to navigate and view Pokémon information.

How It Works

HTML Structure: The HTML file sets up the basic structure of the web page, including a container for displaying Pokémon. CSS Styling: The embedded CSS styles the Pokémon cards and ensures a clean and consistent look. JavaScript Functionality: When the page loads, JavaScript fetches data for the first 10 Pokémon from the PokéAPI. Each Pokémon's name and image are extracted and displayed in a styled card format on the web page.

Example Code

Here's a snippet of the core JavaScript functionality used in the project:

javascript Copy code document.addEventListener('DOMContentLoaded', () => { const pokemonContainer = document.getElementById('pokemon-container');

const fetchPokemon = async (id) => {
    const response = await fetch(`https://pokeapi.co/api/v2/pokemon/${id}`);
    const pokemon = await response.json();
    return pokemon;
};

const displayPokemon = (pokemon) => {
    const pokemonElement = document.createElement('div');
    pokemonElement.classList.add('pokemon');
    pokemonElement.innerHTML = `
        <h3>${pokemon.name.charAt(0).toUpperCase() + pokemon.name.slice(1)}</h3>
        <img src="${pokemon.sprites.front_default}" alt="${pokemon.name}">
    `;
    pokemonContainer.appendChild(pokemonElement);
};

const loadPokemons = async () => {
    for (let i = 1; i <= 10; i++) { // Display first 10 Pokémon
        const pokemon = await fetchPokemon(i);
        displayPokemon(pokemon);
    }

pok-monapi's People

Contributors

amandaevola 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.