Coder Social home page Coder Social logo

arlagonix / countries-list Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3.32 MB

REST Countries API with color theme switcher. Solution to a FrontendMentor challenge

Home Page: https://arlagonix.github.io/countries-list/

License: MIT License

TypeScript 97.14% CSS 1.84% HTML 1.01%
css dark-mode html javascript react-query react-router reactjs styled-components cypress github-actions react typescript vitest

countries-list's Introduction

Where is the world

Made with HTML, CSS, TypeScript, ReactJS, styled-components
Bootstrapped with Vite

GitHub Workflow Status GitHub last commit GitHub

πŸ–Ό Screenshots β€’ ℹ️ About β€’ βš™οΈ Tools β€’ πŸ”¨ How to Build Project β€’ πŸ“ File Structure

πŸ“¦ NPM Packages worth mentioning β€’ πŸ’‘ Details β€’ πŸ”— Useful resources β€’ πŸ‘€ Author

πŸ–Ό Screenshots

ℹ️ About

This is a solution to the challenge "REST Countries" from Frontend Mentor (link).

The challenge is to integrate with the REST Countries API to pull country data and display it like in the designs.

I made my own Figma prototype and redesigned the whole application.

Figma prototype: https://www.figma.com/file/9TUVcloltVpCdi5LHVCiVT/Countries

βš™οΈ Tools

  • HTML5
    • ReactJS
  • CSS
    • styled-components
  • TypeScript
    • ReactJS
    • React Query
    • React Router
    • Vitest
    • Cypress
  • NodeJS
  • Vite
  • Github Pages
  • Github Actions for CI/CD

πŸ”¨ Build project

Command Description
npmΒ install First of all install all required packages
npmΒ runΒ dev Starts a local web server with HMR (Hot Module Replacement) for development
npmΒ runΒ build Builds the project, and outputs to the ./build folder
npmΒ runΒ preview Start a local web server that serves the built solution from ./build for previewing
npmΒ runΒ test:e2e Open application that allows to run 2e2 tests
npmΒ runΒ test:unit Runs unit tests
npmΒ runΒ lint Check that code conforms to Eslint

πŸ“ File Structure

β”œβ”€β”€ πŸ“ .github
|   β”œβ”€β”€ πŸ“ workflows
|   |   └── πŸ“ main.yaml      CI/CD instructions for Github Actions
β”‚   └── πŸ“ dependabot.yml     Instructions for Dependabot
|
β”œβ”€β”€ πŸ“ cypress                End-to-end tests
β”‚
β”œβ”€β”€ πŸ“ docs                   Additional information, documentation 
β”‚   └── πŸ“ results            Screenshots of how the application works after being fully developed
|
β”œβ”€β”€ πŸ“ src                            Source files needed for application development
β”‚   β”œβ”€β”€ πŸ“ assets                     Static assets: images, icons, favicons
β”‚   β”œβ”€β”€ πŸ“ components                 React components
|   |   └── πŸ“ Component Name
|   |       β”œβ”€β”€ πŸ“ index.tsx          Component logic
|   |       β”œβ”€β”€ πŸ“ index.styled.tsx   Component styles
|   |       └── πŸ“ index.types.tsx    Component types (optional)
β”‚   β”œβ”€β”€ πŸ“ global                     Global styles
β”‚   β”œβ”€β”€ πŸ“ hooks                      Custom React hooks
β”‚   β”œβ”€β”€ πŸ“ pages                      React page components
|   |   └── πŸ“ Page Name
|   |       β”œβ”€β”€ πŸ“ index.tsx          Page logic
|   |       β”œβ”€β”€ πŸ“ index.styled.tsx   Page styles
|   |       └── πŸ“ index.types.tsx    Page types (optional)
β”‚   β”œβ”€β”€ πŸ“ utils                      Utility functions
β”‚   β”œβ”€β”€ πŸ“ App.tsx                    App React component
β”‚   β”œβ”€β”€ πŸ“ index.html                 Main html file
β”‚   β”œβ”€β”€ πŸ“ index.tsx                  Entry point for the module bundler
β”‚   β”œβ”€β”€ πŸ“ styled.d.ts                Types for Styled Components theme
β”‚   β”œβ”€β”€ πŸ“ styles.css                 Styles for the loader displayed until JS is loaded
β”‚   └── πŸ“ vite-end.d.ts              Some Typescript stuff for Vite
|
β”œβ”€β”€ πŸ“ .eslintrc.json         ESLint configuration file
β”œβ”€β”€ πŸ“ .gitignore             Instructions for Git about what files to ignore
β”œβ”€β”€ πŸ“ LICENSE                MIT License. Basically you can do whatever you want with the code
β”œβ”€β”€ πŸ“ README.md              Project description
β”œβ”€β”€ πŸ“ cypress.config.cjs     Cypress configuration file
β”œβ”€β”€ πŸ“ package-lock.json      Keeps track of the exact version of every package that is installed
β”œβ”€β”€ πŸ“ package.json           Various metadata relevant to the project, scripts, dependencies
β”œβ”€β”€ πŸ“ tsconfig.json          TypeScript configuration file
β”œβ”€β”€ πŸ“ tsconfig.node.json     TypeScript configuration file for Vite
└── πŸ“ vite.config.js         Vite configuration file

πŸ“¦ NPM Packages worth mentioning

styled-components For CSS-in-JS
react-loading-skeleton Used it to show skeletons while fetching new data
react-outside-click-handler Used it to close options list in select component when clicking outside
react-router-dom Routing between pages
react-transition-group Animates showing and hiding of options list
antd Used 1 component from it : Image, that helps to open image in a full-screen mode
@tanstack/react-query,
@tanstack/react-query-devtools
API requests
cypress End-to-end testing
vitest Unit testing

πŸ’‘ Details

Another project that seemed to be very simple, but took 2-3 weeks to complete

Features

  • Light / Dark mode
  • Skeletons during load
  • Page for the list of countries, page for a country
  • Custom select, input fields
  • Used a component from Ant Design (but it looks like it made the bundle realy, really big)
  • Unit & e2e testing
  • CI/CD with Github Actions. Automatically lint, unit test, e2e test, build and deploy to Github Pages

πŸ”— Useful resources

πŸ‘€ Author

countries-list's People

Contributors

arlagonix avatar dependabot[bot] avatar

Watchers

 avatar  avatar

countries-list's Issues

Create a custom select

  • Change color on focus
  • Placeholder moves up on focus, moves down on blur
  • Placeholder stays up when there is value in it
  • Display list of elements
  • Hover animation of elements
  • List hide when click outside

Create a custom input

  • Change color on focus
  • Correct height
  • Correct icon
  • Placeholder moves up on focus, move down on blur

Make navigation menu

  • Stick to top
  • Hide shadow when nav is on top
  • Show shadow when nav is not on top
  • Header is link that leads to list, change color on hover
  • Responsive
  • Reuse it via router

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.