Git Product home page Git Product logo

github-search-typescript's Introduction

Table of contents

General Info

Allows the users to search the users or repositories or issues on GitHub. Using Github New Api https://docs.github.com/en/rest

The App search users, repos, issues and cache search query in the localstorage with the result using redux and redux persist.

When user start typing and characters exceded 3 characters it the app will start changing the url to the category and keyword and then the Home page will hydrate the data from Url and start checking if the data already has been searched for before will recall it from localstorage provided by redux persist, if not will fire axios call to call github Api and return the data then List component will take the data and category to decide to render which component.

Used Stack

Created by Create React App with Typescript

  • React.js
  • TypeScript
  • Redux and redux-persist
  • React Router
  • Styled Components

Development decisions

was thinking to implement Redux saga to listen to state change and fire the dispatch but it wasn't in the requirements.

Why create react app create react app prepare everything to start modern single page with react and save a lot of time in setup the build configuration.

Styled components has full theming support by exporting a wrapper component. This component provides a theme to all React components underneath itself via the context API. Which make it easy to add themes colors and fonts to provide for the needed component.

Components Separting the components so it will be easy to be reuseable with less logic possible while sometimes we need to write some logic.

Service to Seperate the concern of coding by creating service which responsible only to fetch the data and then the component will manage the request.

User Profile doesn't have location or enough information to show as per the new API implementation. so I went with only showing the name, image and follow link aslo I used the same user Profile in repos and issues but with a flag to change the layout.

404 Error Page if the path provided is not the right one

Edge Cases All edge cases has been covered

  • long text
  • empty keyword data will not recall the api will fetch it from localstorage
  • deleting the keyword
  • etc..

Folder Structure

/src
  ├── __tests__       # For now it contains only App test
  ├── @types          # All Types used throught the app
  ├── assets          # Contains Logo and icons
  ├── constansts      # Global constats
  ├── components      # All Components 
  │   ├── UserProfile
  │   ├── Card
  │   ├── CardDetails
  │   ├── Header
  │   ├── Hooks
  │   ├── List
  │   ├── ListItem
  │   ├── Loader
  │   ├── Search
  │   ├── SearchInput
  │   ├── SelectInput
  ├── pages           # Containe ( Home, 404 ) pages
  │   ├── Home 
  │   ├── Error/404
  ├── service         # Service logic to connect to Github API
  ├── store           # Redux store setup ( actions, reduces )
  │   ├── actions
  │   ├── reducers 
  │   ├── store 
  ├── utils           # Utilites for hold helper functions

Setup

Install dependencies:

yarn

Run App to run localy you need to create .env file first and add Git_Token variables

yarn start

Run Tests

yarn test

Demo

https://github-searcher-typescript.vercel.app/

Future Enhancement

  • Write more unit test
  • Write Cypress test
  • UI enhancment
  • Performance enhanching ( Speed Index and Time to Interactive, dns-prefetch )
  • Clear Localstorage after specific time

github-search-typescript's People

Contributors

hanyrabah avatar

Watchers

 avatar  avatar

Forkers

ia7medd

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.