Improve landscape layout across device sizes

This commit is contained in:
Liam Westby 2018-03-29 11:29:01 -05:00
parent 55078e8b24
commit f5c73f1af2
2 changed files with 65 additions and 11 deletions

View File

@ -1,11 +1,14 @@
<div id="titlebar" class="navbar"> <div id="controls-container" [style.height.px]="windowHeight">
<div id="titlebar" class="navbar">
<h1>Liberty Bikes</h1> <h1>Liberty Bikes</h1>
</div> </div>
<div id="game-buttons" class="navbar"> <div id="game-buttons" class="navbar">
<button type="button" (click)="startGame()">Start Game</button> <button type="button" (click)="startGame()">Start Game</button>
<button type="button" (click)="requeue()">Requeue</button> <button type="button" (click)="requeue()">Requeue</button>
</div> </div>
<div id="controller" [style.height.px]="windowHeight"> <div id="controller">
<canvas id="dpad-canvas" width="800" height="800"></canvas> <canvas id="dpad-canvas" width="800" height="800"></canvas>
</div>
</div> </div>

View File

@ -13,6 +13,17 @@ body {
height: 100%; height: 100%;
} }
#controls-container {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
display: flex;
align-items: center;
}
.navbar { .navbar {
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
@ -29,6 +40,8 @@ body {
top: 0; top: 0;
width: 100%; width: 100%;
background: none;
justify-content: center; justify-content: center;
} }
@ -57,6 +70,8 @@ body {
width: 100%; width: 100%;
padding: 0px 5px; padding: 0px 5px;
border-top: 1px solid white;
} }
#game-buttons button { #game-buttons button {
@ -79,25 +94,61 @@ body {
margin: 0 auto; margin: 0 auto;
} }
@media screen and (max-height: 465px) {
#titlebar h1 {
font-size: 1em;
}
}
@media screen and (orientation: landscape) { @media screen and (orientation: landscape) {
:host { #controls-container {
display: grid; display: grid;
grid-template-rows: 1fr 1fr; grid-template-rows: 1fr 1fr;
grid-template-columns: 1fr 1fr; grid-template-columns: auto 1fr;
justify-content: center;
align-items: center;
padding: 0 20px;
} }
#titlebar { #titlebar {
position: relative; position: relative;
grid-area: 1 / 2; grid-area: 1 / 2;
background: none;
height: 100%;
font-size: 1.5em;
} }
#game-buttons { #game-buttons {
position: relative; position: relative;
grid-area: 2 / 2; grid-area: 2 / 2;
height: 100%;
justify-content: space-around;
align-items: flex-start;
border-top: none;
background: none;
}
#game-buttons button {
width: 150px;
height: 100px;
letter-spacing: unset;
} }
#controller { #controller {
grid-area: 1 / 1 / span 2 / span 1; grid-area: 1 / 1 / span 2 / span 1;
grid-template: calc(100vmin - #{($titlebar) * 2}) / calc(100vmin - #{($titlebar) * 2}); grid-template: calc(100vmin - #{($titlebar) * 2}) / calc(100vmin - #{($titlebar) * 2});
} }
@media screen and (max-height: 320px), screen and (max-width: 569px) {
#game-buttons button {
height: 50px;
}
}
} }