Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

pernillasterner
Copy link

pernillasterner and others added 10 commits April 17, 2024 12:36
* 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
Copy link

@HIPPIEKICK HIPPIEKICK left a 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! 🐻

Comment on lines +1 to +11
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>
);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice loader 🧭

Comment on lines +11 to +14
const handleToggleBtn = () => {
// Get alla descriptionContainer
setToggleDescription(!toggleDescription);
};

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

Comment on lines +14 to +24
{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>
))}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +18 to +23
const regex = "^[a-zA-Z _-]+$";
if (!username.match(regex)) {
setErrorMessage("Username can only contain letters");
setUsername("");
return;
}

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();

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) {

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,

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?

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 ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants