Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- :global(html) {
- background: black;
- }
- main {
- text-align: center;
- padding: 1em;
- max-width: 240px;
- margin: 0 auto;
- }
- button {
- background: #14c07c;
- border: none;
- color: white;
- cursor: pointer;
- border-radius: 20px;
- padding: 20px;
- }
- h1 {
- color: #14c07c;
- text-transform: uppercase;
- font-size: 4em;
- font-weight: 100;
- }
- h2 {
- color: #14c07c;
- font-weight: 100;
- }
- p {
- color: #f4f4f4;
- }
- @media (min-width: 640px) {
- main {
- max-width: none;
- }
- }
- .header {
- display: grid;
- grid-template-columns: 30% 70%;
- margin: 0 auto;
- align-items: center;
- }
- .title {
- font-size:60px;
- text-align: center;
- margin: 30px 0;
- font-weight: bold;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
- color: #14c07c;
- }
- .score-box {
- background-color: #C9BBAE;
- padding: 3px 0px;
- margin: 50px auto 0 auto;
- text-align: center;
- width: 100px;
- height:65px;
- border-radius: 5px;
- }
- .score-title{
- font-size:20px;
- color: #eee4da;
- }
- .score-number {
- font-size:30px;
- color: white;
- }
- .scorer{
- float: left;
- width: 30%;
- }
- reset-box {
- padding: 3px 0px;
- text-align: center;
- width: 100px;
- height:65px;
- border-radius: 5px;
- }
- .reset-box h1:hover {
- color: #bbada0;
- cursor: pointer;
- }
- .rules-box {
- max-width: 500px;
- margin: 0 auto;
- }
- .main-main {
- display: inline-block;
- /*display: grid;*/
- /*grid-template-columns: 30% 80%;*/
- width: 100%;
- height: 70%;
- }
- main {
- max-width: 40%;
- min-height: 70%;
- max-height: 80%;
- margin-left: 0;
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-template-rows: repeat(4, 1fr);
- gap: 20px;
- background-color: #bbada0;
- padding: 20px;
- box-sizing: border-box;
- border-radius: 5px;
- }
- .tile {
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
- width: 100%;
- height: 100%;
- background-color: #c9bbae;
- display: grid;
- place-items: center;
- font-size: 3em;
- border-radius: 5px;
- color: #776e65;
- font-weight: bold;
- }
- .two {
- background-color: #eee4da;
- }
- .four {
- background-color: #ede0c8;
- }
- .eight {
- background-color: #f2b179;
- }
- .sixteen {
- background-color: #f59563;
- }
- .thirtytwo {
- background-color: #f67c60;
- }
- .sixtyfour {
- background-color: #f65e3b;
- }
- .onetwoeight {
- background-color: #edcf73;
- }
- .twofivesix {
- background-color: #edcc62;
- }
- .fiveonetwo {
- background-color: #edc850;
- }
- .onezerotwofour {
- background-color: #edc53f;
- }
- .twozerofoureight {
- background-color: #edc22d;
- }
- </style>
- <svelte:window on:keydown={keyPress} />
- <div class="header">
- <h1 class="title">2048</h1>
- <div class="reset-box">
- <h1 on:click={reset}>Перезапустить</h1>
- </div>
- </div>
- <div class="main-main">
- <div class="scorer">
- <div class="score-box">
- <p class="score-title">Счет</p>
- <p class="score-number">{game.score}</p>
- </div>
- <div class="score-box second">
- <p class="score-title">Лучший</p>
- <p class="score-number">{game.best}</p>
- </div>
- </div>
- <main>
- {#each numbers as arr, i}
- {#each arr as num, i}
- <div
- class="tile {num === 2 ? 'two' : num === 4 ? 'four' : num === 8 ? 'eight' : num === 16 ? 'sixteen' : num === 32 ? 'thirtytwo' : num === 64 ? 'sixtyfour' : num === 128 ? 'onetwoeight' : num === 256 ? 'twofivesix' : num === 512 ? 'fiveonetwo' : num === 1024 ? 'onezerotwofour' : num === 2048 ? 'twozerofoureight' : ''}">
- {num !== 0 ? num : ''}
- </div>
- {/each}
- {/each}
- </main>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement