├── src ├── App.css ├── index.css ├── main.jsx ├── components │ ├── Footer.jsx │ ├── TypeList.jsx │ └── Header.jsx ├── App.jsx ├── pages │ ├── Dex.jsx │ └── Poke.jsx └── assets │ └── react.svg ├── img └── banner.png ├── vercel.json ├── vite.config.js ├── .gitignore ├── index.html ├── package.json ├── eslint.config.js ├── public └── logo.svg └── README.md /src/App.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoaoPedrosoDev/JPoke/HEAD/img/banner.png -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | 4 | 5 | @theme { 6 | --font-poppins: Poppins, sans-serif; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { 4 | "source": "/(.*)", 5 | "destination": "/index.html" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | import tailwindcss from '@tailwindcss/vite' 4 | 5 | export default defineConfig({ 6 | plugins: [react(), tailwindcss(),], 7 | }) 8 | -------------------------------------------------------------------------------- /src/main.jsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | import './index.css' 4 | import App from './App.jsx' 5 | 6 | createRoot(document.getElementById('root')).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /src/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | function Footer() { 2 | return ( 3 | 6 | ); 7 | } 8 | 9 | export default Footer; 10 | -------------------------------------------------------------------------------- /src/components/TypeList.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const TypeList = ({ types }) => { 4 | return ( 5 |
6 | {types.map((t, index) => ( 7 | <> 8 | {t.type.name} 9 | {index !== types.length - 1 && ' / '} 10 | 11 | ))} 12 |
13 | ); 14 | }; 15 | 16 | export default TypeList; 17 | -------------------------------------------------------------------------------- /src/App.jsx: -------------------------------------------------------------------------------- 1 | import Poke from './pages/Poke' 2 | import Dex from './pages/Dex' 3 | import Header from './components/Header' 4 | import Footer from './components/Footer' 5 | 6 | import './App.css' 7 | import {BrowserRouter, Routes, Route} from "react-router-dom" 8 | 9 | function App() { 10 | 11 | return ( 12 | <> 13 |
14 |
15 | 16 | 17 | } /> 18 | } /> 19 | 20 | 21 |
23 | 24 | 25 | 26 | ) 27 | } 28 | 29 | export default App 30 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | PokeAPI 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 20 | -------------------------------------------------------------------------------- /src/components/Header.jsx: -------------------------------------------------------------------------------- 1 | function Header(){ 2 | return ( 3 |
4 |
5 |

JPoke

6 | 16 |
17 |
18 | 19 |
20 |
21 | ) 22 | } 23 | 24 | export default Header; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-pokeapi", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "vite build", 9 | "lint": "eslint .", 10 | "preview": "vite preview" 11 | }, 12 | "dependencies": { 13 | "@tailwindcss/vite": "^4.0.8", 14 | "react": "^19.0.0", 15 | "react-dom": "^19.0.0", 16 | "react-router-dom": "^7.3.0" 17 | }, 18 | "devDependencies": { 19 | "@eslint/js": "^9.19.0", 20 | "@types/react": "^19.0.8", 21 | "@types/react-dom": "^19.0.3", 22 | "@vitejs/plugin-react": "^4.3.4", 23 | "autoprefixer": "^10.4.20", 24 | "eslint": "^9.19.0", 25 | "eslint-plugin-react": "^7.37.4", 26 | "eslint-plugin-react-hooks": "^5.0.0", 27 | "eslint-plugin-react-refresh": "^0.4.18", 28 | "globals": "^15.14.0", 29 | "postcss": "^8.5.3", 30 | "tailwindcss": "^4.0.12", 31 | "vite": "^6.1.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js' 2 | import globals from 'globals' 3 | import react from 'eslint-plugin-react' 4 | import reactHooks from 'eslint-plugin-react-hooks' 5 | import reactRefresh from 'eslint-plugin-react-refresh' 6 | 7 | export default [ 8 | { ignores: ['dist'] }, 9 | { 10 | files: ['**/*.{js,jsx}'], 11 | languageOptions: { 12 | ecmaVersion: 2020, 13 | globals: globals.browser, 14 | parserOptions: { 15 | ecmaVersion: 'latest', 16 | ecmaFeatures: { jsx: true }, 17 | sourceType: 'module', 18 | }, 19 | }, 20 | settings: { react: { version: '18.3' } }, 21 | plugins: { 22 | react, 23 | 'react-hooks': reactHooks, 24 | 'react-refresh': reactRefresh, 25 | }, 26 | rules: { 27 | ...js.configs.recommended.rules, 28 | ...react.configs.recommended.rules, 29 | ...react.configs['jsx-runtime'].rules, 30 | ...reactHooks.configs.recommended.rules, 31 | 'react/jsx-no-target-blank': 'off', 32 | 'react-refresh/only-export-components': [ 33 | 'warn', 34 | { allowConstantExport: true }, 35 | ], 36 | }, 37 | }, 38 | ] 39 | -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | 4 -------------------------------------------------------------------------------- /src/pages/Dex.jsx: -------------------------------------------------------------------------------- 1 | import { useState, useEffect } from "react" 2 | 3 | function Dex() { 4 | const [Pokemons, SetPokemons] = useState([]); 5 | 6 | async function getAllPokemons() { 7 | try { 8 | const response = await fetch("https://pokeapi.co/api/v2/pokemon?limit=151") 9 | const data = await response.json() 10 | const pokemonDetailsPromises = data.results.map(async (pokemon) => { 11 | const pokemonResponse = await fetch(pokemon.url) 12 | const pokemonData = await pokemonResponse.json() 13 | return { 14 | name: pokemon.name, 15 | sprite: pokemonData.sprites.front_default, 16 | types: pokemonData.types.map(typeInfo => typeInfo.type.name) 17 | } 18 | }) 19 | const pokemonsWithSprites = await Promise.all(pokemonDetailsPromises) 20 | SetPokemons(pokemonsWithSprites) 21 | } catch (error) { 22 | console.error(error) 23 | } 24 | } 25 | 26 | useEffect(() => { 27 | getAllPokemons(); 28 | }, []) 29 | 30 | return ( 31 |
32 |

Lista de Pokémons

33 |
34 | {Pokemons.map((pokemon, index) => ( 35 |
36 |

{pokemon.name}

37 | {pokemon.name} 38 |
39 | {pokemon.types.map((type, typeIndex) => ( 40 | {type} 41 | ))} 42 |
43 |
44 | ))} 45 |
46 |
47 | ); 48 | } 49 | 50 | export default Dex; 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JPOKE 2 | 3 | ![JPOKE](/img/banner.png) 4 | 5 | Este é um projeto em React para buscar e visualizar informações sobre Pokémon utilizando a API pública do [PokeAPI](https://pokeapi.co/). 6 | 7 | ## Funcionalidades 8 | 9 | - **Busca de Pokémon**: Permite que o usuário busque um Pokémon pelo nome, exibindo a imagem, tipos e outras informações. 10 | - **Lista de Pokémons**: Exibe uma lista de 151 Pokémons com suas imagens e tipos. 11 | - **Design Responsivo**: Interface adaptável para diferentes tamanhos de tela utilizando TailwindCSS. 12 | 13 | ## Tecnologias Utilizadas 14 | 15 | ![React Icon](https://img.shields.io/badge/React-111111?style=for-the-badge&logo=react&logoColor=61DAFB) 16 | ![React Router Icon](https://img.shields.io/badge/React_Router-CA4245?style=for-the-badge&logo=react-router&logoColor=white) 17 | ![Tailwind CSS Icon](https://img.shields.io/badge/TailwindCSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white) 18 | ![JavaScript Icon](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black) 19 | 20 | ## Como Rodar o Projeto 21 | 22 | ### 1. Clonar o repositório 23 | 24 | ```bash 25 | git clone https://github.com/JoaoPedrosoDev/JPoke 26 | ``` 27 | ### 2. Instalar as dependências 28 | 29 | ```bash 30 | npm install 31 | ``` 32 | 33 | ### 3. Rodar o projeto 34 | ``` 35 | npm run dev 36 | ``` 37 | ## Descrição dos Arquivos Principais 38 | 39 | - **App.jsx:** Componente principal que gerencia as rotas do aplicativo utilizando o React Router. 40 | 41 | - **Poke.jsx:** Página de busca de Pokémon, onde o usuário pode pesquisar por um Pokémon pelo nome. 42 | 43 | - **Dex.jsx:** Página com a lista de 151 Pokémons e suas informações. 44 | 45 | - **Header.jsx e Footer.jsx:** Componentes para cabeçalho e rodapé da aplicação. 46 | 47 | - **TypeList.jsx:** Componente para exibir os tipos do Pokémon. 48 | 49 | ## Licença 50 | 51 | Este projeto está licenciado sob a **MIT License**. Veja o arquivo [LICENSE](LICENSE) para mais detalhes. 52 | 53 | ### MIT License 54 | 55 | Permite que qualquer pessoa faça uso do código, incluindo a modificação, distribuição e uso pessoal ou comercial, desde que a permissão e o aviso de copyright sejam incluídos nas cópias ou partes substanciais do software. 56 | 57 | A licença MIT não fornece nenhuma garantia e o uso do código é por conta e risco do usuário. 58 | 59 | ## Acesse o Projeto 60 | 61 | Você pode acessar a versão online do projeto clicando no seguinte link: 62 | [JPoke - Visualize o Projeto Aqui](https://jpoke.vercel.app/) 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/pages/Poke.jsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import TypeList from "../components/TypeList"; 3 | 4 | function Poke() { 5 | const [PokeName, SetPokeName] = useState(''); 6 | const [pokemon, setPokemon] = useState(''); 7 | const [erro, setErro] = useState(''); 8 | 9 | async function fetchpoke() { 10 | if (PokeName.trim().length < 3) { 11 | setErro('O nome do Pokémon deve ter pelo menos 3 caracteres.'); 12 | return; 13 | } 14 | setErro(''); 15 | 16 | try { 17 | var response = await fetch(`https://pokeapi.co/api/v2/pokemon/${PokeName.toLocaleLowerCase()}`); 18 | var data = await response.json(); 19 | setPokemon(data); 20 | } catch (error) { 21 | setErro('Pokémon não encontrado. Tente novamente!'); 22 | setPokemon(''); 23 | } 24 | } 25 | return ( 26 |
27 |

Busca Pokemon!

28 |
29 |
30 | SetPokeName(e.target.value)} 38 | /> 39 | 45 | 46 | {erro &&

{erro}

} 47 |
48 |
49 | 50 | {pokemon && ( 51 |
52 |
53 |

{pokemon.name}

54 |
55 | {pokemon.name} 56 |
57 | 58 |
59 |
60 | )} 61 | 62 |
63 | ); 64 | } 65 | 66 | export default Poke; 67 | -------------------------------------------------------------------------------- /src/assets/react.svg: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------