Skip to content

Commit a1fe5c6

Browse files
kixelatedclaude
andauthored
Add back button to game controls UI (#1325)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9c915e0 commit a1fe5c6

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

js/moq-boy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@moq/boy",
33
"type": "module",
4-
"version": "0.2.6",
4+
"version": "0.2.7",
55
"description": "MoQ Boy - Crowd-controlled Game Boy streaming via MoQ",
66
"license": "(MIT OR Apache-2.0)",
77
"repository": {

js/moq-boy/src/ui/components/Controls.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ export default function Controls() {
2626
game.sendCommand({ type: "reset" });
2727
};
2828

29+
const onBack = (e: MouseEvent) => {
30+
e.stopPropagation();
31+
game.expanded.set(undefined);
32+
};
33+
2934
return (
3035
<div class="boy__controls">
36+
<button type="button" class="boy__back-btn" onClick={onBack}>
37+
<span aria-hidden="true"></span> Back
38+
</button>
3139
<Dpad />
3240
<ABButtons />
3341
<MetaButtons />
@@ -64,7 +72,7 @@ export default function Controls() {
6472
<div>Arrows: D-pad</div>
6573
<div>Z: B &nbsp; X: A</div>
6674
<div>Enter: Start &nbsp; Shift: Select</div>
67-
<div>Esc: Collapse</div>
75+
<div>Esc: Back</div>
6876
</div>
6977
</div>
7078
);

js/moq-boy/src/ui/styles/controls.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@
55
gap: 1.5rem;
66
}
77

8+
/* Back button */
9+
.boy__back-btn {
10+
width: 100%;
11+
background: var(--color-white-alpha-05);
12+
color: var(--boy-text-muted);
13+
border: 1px solid var(--boy-border);
14+
padding: 0.5rem;
15+
border-radius: 6px;
16+
cursor: pointer;
17+
font-size: 0.75rem;
18+
transition: all 0.15s;
19+
}
20+
21+
.boy__back-btn:hover {
22+
border-color: var(--boy-accent);
23+
color: var(--boy-text);
24+
}
25+
26+
.boy__back-btn:active {
27+
transform: scale(0.98);
28+
}
29+
830
/* D-pad grid */
931
.boy__dpad {
1032
display: grid;

0 commit comments

Comments
 (0)