1.1.1 • Published 6 years ago

react-memory-game v1.1.1

Weekly downloads
65
License
ISC
Repository
github
Last release
6 years ago

Build Status

What is react-memory-game?

Is a memory game engine built in react to use in react applications. This is not a game per se but a library to allow you to build your own memory games.

Disclaimer: it is extremely early days and functionality is very limited. It is currently very experimental, you should not use this for anything that is not throwaway code.

How do I do it?

Create your react project. For instance, you can do that using create-react-app.

create-react-app my-awesome-memory-game
cd my-awesome-memory-game

Import the library into your Component and make use of

<MemoryGame cards={[ /* cards */]} />
<MemoryGame.Board />
<MemoryGame.Reset />
<MemoryGame.MovesCounter />
<MemoryGame.PairsFoundCounter />
import React from "react";
import styled from "styled-components";
import MemoryGame from "react-memory-game";
import "react-memory-game/lib/default-theme.css";

const Wrap = styled.div`
  font-size: 120px;
`;

const GameContainer = styled.div`
  display: flex;
`;

const PanelContainer = styled.div`
  width: 200px;
  order: -1;
`;

const BoardContainer = styled.div`
  flex: 1;
`;

const App = () => (
  <MemoryGame
    cards={[
      <Wrap>💩</Wrap>,
      <Wrap>🤷</Wrap>,
      <Wrap>❤️</Wrap>,
      <Wrap>😂</Wrap>,
      <Wrap>😍</Wrap>,
      <Wrap>😊</Wrap>,
      <Wrap>🤔</Wrap>,
      <Wrap>🔥</Wrap>
    ]}
  >
    <GameContainer>
      <BoardContainer>
        <MemoryGame.Board />
      </BoardContainer>
      <PanelContainer>
        <MemoryGame.Reset />
        <MemoryGame.MovesCounter />
        <MemoryGame.PairsFoundCounter />
      </PanelContainer>
    </GameContainer>
  </MemoryGame>
);
export default App;
1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago