Git Product home page Git Product logo

react-samplewars's Introduction

React - Sample Wars

MIT ยฉ December 2019

Hello there, This is my sample of code written in React, Next.JS, SASS, TypeScript and Jest. If you have any questions, feel free to contact me by mail ([email protected]).

Heroku

This app is on live on heroku: https://react-samplewars.herokuapp.com

How to run

Best with yarn and node 10.16

Development

  1. Just download it with git clone
  2. Run yarn or npm install
  3. Run yarn dev or npm run dev
  4. Enjoy ๐Ÿ”ฅ

Production

  1. Just download it with git clone
  2. Run yarn or npm install
  3. Run yarn build or npm run build
  4. Run yarn start or npm run start
  5. Enjoy ๐Ÿš€

Assumptions

A simple game in React (Next.JS) that allows you to fight between two characters or starships from SWAPI (https://swapi.dev).

  • There's score counter which counts how many wins player and opponent.
  • Option to select resources for each player
  • Material-UI components (Focused only on TypeScript part).

Git (GitHub)

There's are pre-commits that's check eslint (with auto-fixes), JEST and Next Build before every commits. GitHub only actions for performing pre-commits check on every commits for NodeJS 10.x and 12.x.

Api

I used SWAPI (https://swapi.dev) that fetch and transform all data during first visit (page: /index.tsx). Then data is stored on client side (in localStorage) and it's valid for 8 hours.

  • src/dao/swapi.ts
  • pages/index.tsx

React

Higher-order component (HOC):

  • src/services/withSettings.tsx

Class components:

  • src/services/withSettings.tsx (wrapped in HOC)
  • pages/_document.tsx
  • pages/_app.tsx

Functional Components:

  • Every elsewhere ๐Ÿ™Œ๐Ÿป

Styled-components ๐Ÿ’…

  • src/modules/Game/index.tsx
  • src/components/TopBar/index.tsx

Material-UI

  • You will find them in every component! ๐Ÿคท๐Ÿปโ€โ™‚๏ธ

makeStyles():

  • src/components/Scoreboard/index.tsx

RxJS

RxJS is used as HOC and Hook just to show my abilities. Hooks are used in:

  • src/components/SelectKind/index.tsx
  • src/components/Scoreboard/index.tsx

Higher-order-component:

  • src/components/Result/index.tsx
  • src/components/Details/index.tsx

BehaviorSubject:

  • src/services/settings.ts

Jest

  • src/components/SelectCharacter/test

Express.JS

  • server.js

react-samplewars's People

Contributors

amadeuszblanik avatar

Watchers

James Cloos avatar  avatar Arkadiusz Lis 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.