Skip to content
Snippets Groups Projects
Commit 697e237d authored by jherman5's avatar jherman5
Browse files

Added exportation functions for initial state values. There is an error that...

Added exportation functions for initial state values. There is an error that needs to be fixed, but once it is, Checkpoint 5 completed.
parent 343f5264
No related branches found
No related tags found
No related merge requests found
.title{ .title{
font-size: 1.5em; font-size: 1.5em;
width: 100%; width: 50%;
left: 10em; left: 10em;
right: 10em; right: 10em;
} }
.score{
font-size: 1.5em;
width: 50%
}
.redbutton{ .redbutton{
background-color: #f44336; background-color: #f44336;
border: none; border: none;
width: 50%; width: 50%;
height: 20em; height: 20em;
} }
.redlit{
background-color: #f44336;
border: #ffffff;
width: 50%;
height: 20em;
}
.bluebutton{ .bluebutton{
background-color: #008CBA; background-color: #008CBA;
border: none; border: none;
width: 50%; width: 50%;
height: 20em; height: 20em;
} }
.bluelit{
background-color: #008CBA;
border: #ffffff;
width: 50%;
height: 20em;
}
.yellowbutton{ .yellowbutton{
background-color: #ffff00; background-color: #ffff00;
border: none; border: none;
width: 50%; width: 50%;
height: 20em; height: 20em;
} }
.yellowlit{
background-color: #ffff00;
border: #ffffff;
width: 50%;
height: 20em;
}
.greenbutton{ .greenbutton{
background-color: #4CAF50; background-color: #4CAF50;
border: none; border: none;
width: 50%; width: 50%;
height: 20em; height: 20em;
} }
#wrapper{ .greenlit{
width: 100%; background-color: #4CAF50;
background-color:#ffffff; border: #ffffff;
margin-left: auto; width: 50%;
margin-right: auto; height: 20em;
margin-top:10px;
margin-bottom:10px;
padding:10px;
line-height:150%;
clear:both;
} }
import React from 'react'; import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import styles from './buttonLayout.css'; import styles from './buttonLayout.css';
import {
selectBorderState,
selectPatternList,
selectScore,
} from './patternSlice';
export function Pattern() { export function Pattern() {
const borderState = useSelector(selectBorderState);
const score = useSelector(selectScore);
const patternList = useSelector(selectPatternList);
const redclasses = classNames({
[styles.redbutton]: borderState === 0,
[styles.redlit]: borderState === 1,
})
const blueclasses = classNames({
[styles.bluebutton]: borderState === 0,
[styles.bluelit]: borderState ===1,
})
const yellowclasses = classNames({
[styles.yellowbutton]: borderState === 0,
[styles.yellowlit]: borderState ===1,
})
const greenclasses = classNames({
[styles.greenbutton]: borderState === 0,
[styles.greenlit]: borderState ===1,
})
return ( return (
<main> <main>
<div> <div>
<blockquote class = 'title'> <blockquote class = 'title'>
Simon Says Simon Says
</blockquote> </blockquote>
<blockquote> <blockquote class = 'score'>
Score: 0 Score: 0
</blockquote> </blockquote>
<button class = "redbutton"> <button className = {redclasses}>
</button> </button>
<button class = "bluebutton"> <button class = "bluebutton">
</button> </button>
......
...@@ -14,3 +14,15 @@ export default patternSlice; ...@@ -14,3 +14,15 @@ export default patternSlice;
export const { export const {
} = patternSlice.actions; } = patternSlice.actions;
export function selectBorderState(state) {
return state.pattern.borderState;
}
export function selectPatternList(state) {
return state.pattern.patternList;
}
export function selectScore(state) {
return state.pattern.score;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment