From 649f942ea2058b25d1233b68d7695538c062872a Mon Sep 17 00:00:00 2001 From: Albert Ruan Date: Thu, 2 Mar 2023 20:15:43 +0800 Subject: [PATCH] adds error message for wrong input --- .../Control-Template.component.jsx | 31 ++++++++++++------- .../Control-Template.styles.css | 8 +++++ src/redux/control/control.reducer.js | 4 +++ src/redux/control/control.selectors.js | 2 ++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/Components/Control-Template/Control-Template.component.jsx b/src/Components/Control-Template/Control-Template.component.jsx index 7b18883..96a538f 100644 --- a/src/Components/Control-Template/Control-Template.component.jsx +++ b/src/Components/Control-Template/Control-Template.component.jsx @@ -2,10 +2,10 @@ import React from 'react'; import './Control-Template.styles.css'; import { createStructuredSelector } from 'reselect'; import { connect } from 'react-redux'; -import { selectLevel, selectSpellInput } from '../../redux/control/control.selectors'; +import { selectLevel, selectSpellInput, selectErrorMessage } from '../../redux/control/control.selectors'; import { HandleSpellInputChange, OnSpellSubmit } from '../../redux/control/control.actions'; -const ControlTemplate = ({ submitSpell, spell_input, hints, headerText, level, handleChange }) => { +const ControlTemplate = ({ submitSpell, spell_input, hints, headerText, level, handleChange, error_message }) => { //they are the only unique things to each Control //level comes from reducer now //the caveat of using controlTemplate is that ,now , we have to clear our spell_input every time a user submit the spell correctly //to make classnames dynamic to the level value. @@ -22,18 +22,24 @@ const ControlTemplate = ({ submitSpell, spell_input, hints, headerText, level, h {hints}

Don't forget to finish your spell with semicolon ;

-

#fire_spell {

-

display: flex;

-