mirror of
https://github.com/tiennm99/noitu.git
synced 2026-10-11 03:13:45 +00:00
fix(web): keep the whole board on screen as the chain grows
Giving up was a button under the chain, and the chain is the one part of the board with no ceiling: the longer a game ran, the further off the bottom of the screen it went — worst exactly when a player wants it. It sits above the list now, on the right, away from the field a player is typing into, in the danger colour and at a full 44px. The chain takes the height that is left and scrolls inside itself, so the syllable, the clock and the word field stay where they are however long it gets. The error banner's dismiss cross gets the same 44px, negative-margined back out so the banner keeps its height.
This commit is contained in:
1 parent
3212d8fc1a
commit
f49b906519
2 files changed
+28
-4
No files matched your search
@@ -85,8 +85,12 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
/* Takes whatever height the board has left so the list scrolls inside
|
||||||
|
itself; the syllable, the input and the buttons above it stay put
|
||||||
|
however long the chain gets. */
|
||||||
.chain {
|
.chain {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,11 +72,14 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<ChainHistory />
|
<!-- Above the chain, not below it: the chain is the one part of the board
|
||||||
|
that grows, and a button under it walks off the bottom of the screen
|
||||||
|
exactly as the game gets long enough to want to give up on. -->
|
||||||
{#if game.state.phase === 'playing' && !game.iAmOut}
|
{#if game.state.phase === 'playing' && !game.iAmOut}
|
||||||
<button type="button" class="resign" onclick={onresign}>{t.resign}</button>
|
<button type="button" class="resign" onclick={onresign}>{t.resign}</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<ChainHistory />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -146,9 +149,17 @@
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A 44px target on a glyph that is a fraction of that: the padding is
|
||||||
|
negative-margined back out so the banner keeps its height. */
|
||||||
.error button {
|
.error button {
|
||||||
|
flex: none;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
margin: -12px -6px;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
background: none;
|
background: none;
|
||||||
|
color: inherit;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
@@ -162,13 +173,22 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Right of the board and away from the input: giving up is the one thing
|
||||||
|
here nobody should hit by accident while typing. Danger coloured because
|
||||||
|
it ends the game, subordinate because it is not the way to play it. */
|
||||||
.resign {
|
.resign {
|
||||||
align-self: center;
|
align-self: flex-end;
|
||||||
|
min-height: 44px;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--text-muted);
|
color: var(--danger);
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
|
transition: background-color 150ms ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resign:hover {
|
||||||
|
background: var(--danger-soft);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user