Coder Social home page Coder Social logo

victorbr988 / jogo-de-trivia Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 523 KB

Um jogo de perguntas e respostas feito com React.js para treinar seus conhecimentos gerais e seu Inglês

Home Page: jogo-de-trivia-rho.vercel.app

HTML 0.78% JavaScript 99.09% CSS 0.13%

jogo-de-trivia's Introduction

Bem vindo ao jogo de Trivia

Este projeto foi desenvolvido em grupo por mim e mais 3 pessoas

Integrantes do grupo

  1. Samuel dos Reis
  2. Matheus Araujo
  3. Ronan Ferreira

Código da trybe:

Caminho: mock/questions.js

Dentro da pasta helpers, possui um arquivo chamado renderWithRouterAndRedux.js

  import React from 'react';
  import { render } from '@testing-library/react';
  import { Router } from 'react-router-dom';
  import { createMemoryHistory } from 'history';
  import { Provider } from 'react-redux';
  import { legacy_createStore as createStore, applyMiddleware } from 'redux';
  import thunk from 'redux-thunk';
  import reducer from '../redux/reducers';
  
  export const renderWithRouterAndRedux = (component, initialState, route = '/') => {
    const store = createStore(reducer, initialState, applyMiddleware(thunk));
    const history = createMemoryHistory({ initialEntries: [route] });
  
    return {
      ...render(
        <Provider store={ store }>
          <Router history={ history }>
            {component}
          </Router>
        </Provider>,
      ),
      history,
      store,
    };
  };
  
  export default renderWithRouterAndRedux;

Desenvolvido por mim

Arquivos de minha autoria

  1. Feedback.js
  2. Ranking.js
  3. Settings.js

Dentro do arquivo Game.js criei a lógica onde é renderizado um contador

  updateState =(click) => {
    const { timer, interval } = this.state;
    if (timer > 0 && click === undefined) {
      return this.setState((prevState) => ({
        timer: prevState.timer - 1,
      }));
    }
    clearInterval(interval);
    this.setState({
      buttonDisable: true,
    });
  }

  resetState = () => {
    this.setState({
      timer: 30,
    });
    this.setTimeOut();
  }

  setTimeOut = () => {
    const TIMER = 1000;
    const interval = setInterval(() => {
      this.setState({ interval });
      this.updateState();
    }, TIMER);
  }

Arqivos de testes de minha autoria

  1. Feedback.test.js

jogo-de-trivia's People

Contributors

victorbr988 avatar

Stargazers

 avatar

Watchers

 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.