Skip to content

Commit e04404e

Browse files
committed
fixed action button behaviour
1 parent 3e9f9d5 commit e04404e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

vanilla-build/css/style.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ button:hover {
138138
color: white;
139139
background-color: rgba(211, 211, 211, 0.05);
140140
border: 1px solid transparent;
141-
border-radius: 10px;
141+
border-radius: 8px;
142142
}
143143

144144
.menu-items {
@@ -148,8 +148,8 @@ button:hover {
148148
right: 0;
149149

150150
background-color: #203139;
151-
border-radius: 2px;
152-
padding: 10px;
151+
border-radius: 8px;
152+
padding: 8px;
153153
}
154154

155155
@media (min-width: 640px) {
@@ -191,7 +191,7 @@ button:hover {
191191
align-items: center;
192192
gap: 2px;
193193

194-
border-radius: 10px;
194+
border-radius: 8px;
195195
}
196196

197197
.score p {
@@ -207,7 +207,7 @@ button:hover {
207207
footer {
208208
color: white;
209209
font-size: 0.8rem;
210-
margin-top: 10vw;
210+
margin-top: 16vw;
211211
}
212212

213213
@media (min-width: 640px) {

vanilla-build/js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ function init() {
156156
const view = new View();
157157
const store = new Store(players);
158158

159-
console.log(store.game);
160-
161159
view.bindGameResetEvent((event) => {
162160
view.closeModal();
163161
view.clearMoves();
@@ -173,6 +171,8 @@ function init() {
173171
});
174172

175173
view.bindPlayerMoveEvent((square) => {
174+
view.closeMenu();
175+
176176
const existingMove = store.game.moves.find(
177177
(move) => move.squareID === +square.id
178178
);

vanilla-build/js/view.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ export default class View {
5252
icon.classList.toggle("fa-chevron-up");
5353
}
5454

55+
closeMenu() {
56+
if (!this.$.menuItems.classList.contains("hidden")) {
57+
this.#toggleMenu();
58+
}
59+
}
60+
5561
handlePlayerMove(squareEl, player) {
5662
const icon = document.createElement("i");
5763
icon.classList.add("fa-solid", player.iconClass, player.colorClass);

0 commit comments

Comments
 (0)