-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Maze App - Pernilla #14
base: main
Are you sure you want to change the base?
Conversation
* Temporary fix to add background image * Add form and functionality to get the username * Basic validation to username * Fetch maze data and pass username in the body to get next action. * Remove global username. No need at this point * Save action and description to global state
* Rearrange components * Prepare loader and add increment step and toggle gameOn in global state * Toggle the direction button and display direction choices * Display first step in the maze game and toggle description information
* Set background image for each step * Add all bg-images and set postion to all directions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep up the good work and be proud of what you've accomplished with Zustand Pernilla! 🐻
import "./Loader.scss"; | ||
import Lottie from "lottie-react"; | ||
import animation from "../../lotties/compass-animation.json"; | ||
|
||
export const Loader = () => { | ||
return ( | ||
<div className="loader__container"> | ||
<Lottie animationData={animation} /> | ||
</div> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice loader 🧭
const handleToggleBtn = () => { | ||
// Get alla descriptionContainer | ||
setToggleDescription(!toggleDescription); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea! On the end screen it would be nice if it was always showing the description
{actions.map((action, index) => ( | ||
<div key={index} className="direction__card"> | ||
<p>{action.description}</p> | ||
<button | ||
type="button" | ||
onClick={() => handleDirection(action.direction)} | ||
> | ||
{action.direction} | ||
</button> | ||
</div> | ||
))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐
const regex = "^[a-zA-Z _-]+$"; | ||
if (!username.match(regex)) { | ||
setErrorMessage("Username can only contain letters"); | ||
setUsername(""); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 💯
import "./../MazeContent.scss"; | ||
|
||
export const StartMaze = () => { | ||
const generatedID = useId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
fill: #b3d0b6; | ||
} | ||
|
||
// @media (prefers-color-scheme: light) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused code
|
||
export const useMazeStore = create((set) => ({ | ||
username: "", | ||
gameOn: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be called isGameOn to follow the naming convention for booleans?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well structured store with well named states and actions ⭐
Netlify link
https://technigo-project-zustand.netlify.app/