Skip to content

Commit

Permalink
add buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Koraus committed Oct 18, 2023
1 parent cf874ca commit ee00acf
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 183 deletions.
7 changes: 1 addition & 6 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import audioUrl from "../assetsx/put-figure.wav";
import { OverlayGui as _OverlayGui } from "./overlay-gui";
import { memo } from "react";
import { Forest } from "./level/forest";
import { MenuWindow as _MenuWindow } from "./menu-window";
import { useState } from "react";

const PlayingField = memo(_PlayingField);
const GameFiguresArea = memo(_GameFiguresArea);
const OverlayGui = memo(_OverlayGui);
const MenuWindow = memo(_MenuWindow);


export default function App() {
const [isMenuOpen, setIsmenueOpen] = useState(false);
return (
<div css={{
position: "fixed",
Expand All @@ -43,8 +39,7 @@ export default function App() {
padding: "2em",
pointerEvents: "none",
}}>
<MenuWindow isOpen={isMenuOpen} setIsOpen={setIsmenueOpen} />
<OverlayGui isMenuOpen={isMenuOpen} setIsmenueOpen={setIsmenueOpen} />
<OverlayGui />
</div>
</div >
);
Expand Down
45 changes: 33 additions & 12 deletions src/app/level/undo-btn.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRecoilState } from "recoil";
import { Undo } from "@emotion-icons/boxicons-regular/Undo";
import { levelRecoil } from "./level-recoil";
import undoIcon from "../../assets/undo-move.svg"

export const UndoBtn = () => {

Expand All @@ -9,22 +9,43 @@ export const UndoBtn = () => {
return (
<button
style={{
fontSize: "14px",
marginBottom: "0.3rem",
display: "flex",
alignItems: "center",
borderRadius: "0.3rem",
fontSize: "1rem",
boxSizing: "border-box",
borderRadius: "1.5vmax",
border: "0.3vmax solid #E4E4E4",
background: "linear-gradient(180deg, #2587E2 0%, #1A4C69 100%)",
padding: "0.5vmax",
width: "fit-content",
position: "fixed",
left: "2vmax",
bottom: "2vmax",
filter: !("prev" in level) ? "grayscale(80%)" : "none",
}}
disabled={!("prev" in level)}
onClick={() => {
if (!("prev" in level)) { return; }
setLevel(level.prev);
}}
> Undo
<span style={{ display: "inline-block", height: "1.5em" }} >
<Undo height={"100%"} />
</span>
}} >
<div style={{
boxSizing: "border-box",
background: "linear-gradient(90deg, #49B5F7 0%, #2578CF 100%)",
borderRadius: "1vmax",
padding: "0.4vmax",
display: "flex",
justifyContent: "center",
alignItems: "center",

}} >
<img
src={undoIcon}
alt="icon"
style={{
display: "block",
width: "4.5vmax",

</button >
}}
/>
</div>
</button>
);
};
26 changes: 0 additions & 26 deletions src/app/menu-btn.tsx

This file was deleted.

109 changes: 0 additions & 109 deletions src/app/menu-window.tsx

This file was deleted.

49 changes: 49 additions & 0 deletions src/app/music-switch-btn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useRecoilState, useRecoilValue } from "recoil";
import soundOnIcon from "../assets/sound-on.svg"
import soundOffIcon from "../assets/sound-off.svg"
import { isSoundOnRecoil } from "./settings/is-sound-on-recoil";

export const MusicSwitchBtn = () => {

const [isSound, setIsSound] = useRecoilState(isSoundOnRecoil);

return (
<button
style={{
fontSize: "1rem",
boxSizing: "border-box",
borderRadius: "1.5vmax",
border: "0.3vmax solid #E4E4E4",
background: "linear-gradient(180deg, #2587E2 0%, #1A4C69 100%)",
padding: "0.5vmax",
width: "fit-content",
position: "fixed",
right: "2vmax",
top: "2vmax",
}}
onClick={
() => setIsSound(!isSound)
}
>
<div style={{
boxSizing: "border-box",
background: "linear-gradient(90deg, #49B5F7 0%, #2578CF 100%)",
borderRadius: "1vmax",
padding: "0.4vmax",
display: "flex",
justifyContent: "center",
alignItems: "center",
}} >
<img
src={isSound ? soundOffIcon : soundOnIcon}
alt="icon"
style={{
display: "block",
width: "4.5vmax",

}}
/>
</div>
</button>
);
};
45 changes: 45 additions & 0 deletions src/app/next-lvl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import randomIcon from "../assets/random-level.svg"

export const NextLvl = () => {

return (
<button
style={{
fontSize: "1rem",
boxSizing: "border-box",
borderRadius: "1.5vmax",
border: "0.3vmax solid #E4E4E4",
background: "linear-gradient(180deg, #2587E2 0%, #1A4C69 100%)",
padding: "0.5vmax",
width: "fit-content",
height: "fit-content",
position: "fixed",
inset: "50%",

}}
onClick={() => location.reload()}

>
<div style={{
boxSizing: "border-box",
background: "linear-gradient(90deg, #49B5F7 0%, #2578CF 100%)",
borderRadius: "1vmax",
padding: "0.4vmax",
display: "flex",
justifyContent: "center",
alignItems: "center",

}} >
<img
src={randomIcon}
alt="icon"
style={{
display: "block",
width: "4.5vmax",

}}
/>
</div>
</button>
);
};
Loading

0 comments on commit ee00acf

Please sign in to comment.