Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Commit

Permalink
set up redux
Browse files Browse the repository at this point in the history
  • Loading branch information
leeandher committed Dec 6, 2018
1 parent 13ba006 commit 527486c
Show file tree
Hide file tree
Showing 14 changed files with 218 additions and 2,125 deletions.
66 changes: 58 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -7,7 +7,9 @@
"node-sass": "^4.10.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
"react-redux": "^6.0.0",
"react-scripts": "2.1.1",
"redux": "^4.0.1"
},
"scripts": {
"sass": "node ./scripts/sass-reduce.js && node-sass --watch src/styles/scss -o src/styles/css",
Expand Down
76 changes: 76 additions & 0 deletions src/actions/actionCreators.js
@@ -0,0 +1,76 @@
/* BOARD ACTIONS */

// Randomize board
export const randomizeBoard = (height, width) => {
return {
type: "RANDOMIZE_BOARD",
height,
width
};
};

// Increment the board by one step
export const incrementBoard = boardData => {
return {
type: "INCREMENT_BOARD",
boardData
};
};

// Clear the board
export const clearBoard = () => {
return {
type: "CLEAR_BOARD"
};
};

// Load a preset board
export const loadPreset = preset => {
return {
type: "LOAD_PRESET",
preset
};
};

/* GAME ACTIONS */

// Play the game
export const playGame = speed => {
return {
type: "PLAY_GAME",
speed
};
};

// Pause the game
export const pauseGame = () => {
return {
type: "PAUSE_GAME"
};
};

/* CONFIG ACTIONS */

export const setSpeed = speed => {
return {
type: "SET_SPEED",
speed
};
};

// Resize the board
export const setSize = (height, width) => {
return {
type: "SET_SIZE",
height,
width
};
};

// Change the theme of the board
export const setTheme = theme => {
return {
type: "SET_THEME",
theme
};
};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Page.js → src/components/Page.js
Expand Up @@ -190,7 +190,7 @@ class Page extends React.Component {
title={
<React.Fragment>
<Icon type="build" />
<span>Patterns</span>
<span>Presets</span>
</React.Fragment>
}
>
Expand Down

0 comments on commit 527486c

Please sign in to comment.