Giter VIP home page Giter VIP logo

display-user-list-by-user-type's Introduction

Requirement

Implement this design and build a react app in TypeScript. The data will be fetcehd with the GraphQL API.

Demo Screenshots

Desktop

image

Responsive on Desktop

image

Mobile Friendly

image

Overview of folder structure and coding approach

  • api: contains queries.ts and aws-exports.js

  • components: contains common reusable components being used in the UI, like AvatarCard, RadioGroup, Text, Title

  • ui: contains the custom ui components as per the design

    • UserTypes.tsx: first part of the UI
    • UserListByType.tsx: second part of the UI
    • UserView.tsx: UserTypes.tsx + UserListByType.tsx
  • Each folder has below files:

    • styles.styled.ts: contains styled-components
    • types.ts: contains typescript types and prop types
    • __tests__: folder contains unit tests for each component
  • If the requirement was more complex, then we would be creating multiple sub-folders for each component, and each sub-folder would have above files

  • UserView component is a wrapper component around UserType and UserListByType

Performance Optimization

  • Using useMemo hook that helps avoiding re-execution of same expensive function in any component. This memoize the values between renders.
  • Using useCallback hook that returns a memoized instance of the method that changes with the change of dependencies (i.e., instead of re-creating the instance of the function in every render, the same instance will be used)

Unit Tests coverage

All files | 89.55 | 81.25 | 82.6 | 90.9 |

display-user-list-by-user-type's People

Contributors

mansi-manhas avatar

Watchers

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