Skip to content

Commit

Permalink
Add frontend mockup.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpearce committed Oct 27, 2023
1 parent 09f4c15 commit 5670787
Showing 1 changed file with 143 additions and 0 deletions.
143 changes: 143 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>2048</title>
<meta name="description" content="A family." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Favicons generated with https://favicon.io. -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<style>
:root {
--background-color: #fce7f3;
--text-color: #ec4899;
}
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
}
html {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: var(--background-color);
}
body {
width: 100%;
padding: 24px;
}
@media (min-width: 560px) {
body {
width: 560px;
}
}
h1 {
margin: 0;
padding: 1rem 0;
font-size: 2.0rem;
font-weight: 800;
}
h1 {
color: var(--text-color);
}
a {
position: relative;
text-decoration: none;
}
/* Animate a solid underline sliding in and out on hover. */
a::after {
content: '';
position: absolute;
/* Ensure sibling underlines overlap during animations. */
width: 101%;
height: 0.05em;
bottom: 0.1em;
left: 0;
z-index: -1;
background-color: var(--text-color);
transform: scaleX(0);
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
a:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
.game {
padding: 8px;
background-color: #fbcfe8;
border-radius: 8px;
border: 4px solid rgba(255, 255, 255,0.25);
}
.stats {
display: flex;
margin: 0 0 1rem 0;
justify-content: space-between;
}
.board {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
font-size: 1.5rem;
}
.cell {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
/* background-color: #fdf2f8; */
--cell-lightness: calc(2 * log(var(--cell-value) + 1));
background-color: hsl(0, 100%, calc(95% - var(--cell-lightness) * 1%));
background-color: hsl(0, 100%, 0.95);
border: 3px solid rgba(255, 255, 255,0.25);
border-radius: 5px;
color: rgba(0, 0, 0, 0.75);
}
.cell div {

}
.cell::before {
content: "";
display: inline-block;
width: 1px;
height: 0;
padding-bottom: 100%;
}
</style>
</head>
<body>
<h1>Twenty Fourty Eight.</h1>
<div class="game">
<div class="stats">
<div class="score"><b>Score</b> 934</div>
<div class="turn"><b>Turn</b> #10</div>
</div>
<div class="board">
<div class="cell" style="--cell-value: 2;">2</div>
<div class="cell" style="--cell-value: 4;">4</div>
<div class="cell" style="--cell-value: 8;">8</div>
<div class="cell" style="--cell-value: 2;">2</div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 2;">2</div>
<div class="cell" style="--cell-value: 4;">4</div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 4;">4</div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 16;">16</div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 0;"></div>
<div class="cell" style="--cell-value: 1024;">1024</div>
<div class="cell" style="--cell-value: 64;">64</div>
</div>
</div>
</body>
</html>

0 comments on commit 5670787

Please sign in to comment.