Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added responsive for laptop and desktop #1

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 55 additions & 43 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>Chess Mazes</title>
<link rel="stylesheet" href="style.css" />
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Montserrat"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css"
/>
<link rel="icon" href="./assets/favicon/favicon.ico" type="image/x-icon" />
</head>

<head>
<title>Chess Mazes</title>
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet'>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" />
<link rel="icon" href="./assets/favicon/favicon.ico" type="image/x-icon" />
</head>

<body>
<style>
.github-fork-ribbon:before {
background-color: #000;
}
</style>
<a class="github-fork-ribbon right-top" href="https://github.com/eternaleclipse/chess-mazes"
data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
<div id="mainContainer">
<h1 id="page-title">Chess Mazes</h1>
<div id="board" />
</div>
<div>
<button class="button" id="btnPrev">Previous</button>
<button class="button" id="btnNext">Next</button>
<button class="button" id="btnLoadFen">Load FEN</button>
<button class="button" id="btnSound">Sound: Off</button>
<button class="button" id="btnNextTheme">🎨</button>
<button class="button" id="btnCheat" style="display: none">✨</button>
<button class="button" id="btnAbout">?</button>
</div>
<div>
<div id="solved-container" class="solved-container">
Solved
<div class="solved-item">None</div>
<body>
<style>
.github-fork-ribbon:before {
background-color: #000;
}
</style>
<a
class="github-fork-ribbon right-top"
href="https://github.com/eternaleclipse/chess-mazes"
data-ribbon="Fork me on GitHub"
title="Fork me on GitHub"
>Fork me on GitHub</a
>
<div id="mainContainer">
<div class="game-container">
<h1 id="page-title">Chess Mazes</h1>
<div class="btn-container">
<button class="button" id="btnPrev">Previous</button>
<button class="button" id="btnNext">Next</button>
<button class="button" id="btnLoadFen">Load FEN</button>
<button class="button" id="btnSound">Sound: Off</button>
<button class="button" id="btnNextTheme">🎨</button>
<button class="button" id="btnCheat" style="display: none">✨</button>
<button class="button" id="btnAbout">?</button>
</div>
<div id="board" />
<div>
<div id="solved-container" class="solved-container">
Solved
<div class="solved-item">None</div>
</div>
</div>
</div>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leader-line/1.0.3/leader-line.min.js"></script>
<script type="module" src="./main.js"></script>

</body>

</html>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leader-line/1.0.3/leader-line.min.js"></script>
<script type="module" src="./main.js"></script>
</body>
</html>
96 changes: 74 additions & 22 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
:root {
--wh: 85px;
}

* {
margin: 0;
padding: 0;
}

body {
font-family: Montserrat, Tahoma, Arial, sans-serif;
display: flex;
}

#page-title {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

#txtSolved {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
font-size: large;
}

#board {
width: 800px;
height: 800px;
width: calc(var(--wh) * 8);
height: calc(var(--wh) * 8);
border: 1px solid black;
display: flex;
flex-wrap: wrap;
Expand All @@ -23,8 +34,8 @@ body {

.square {
position: relative;
width: 100px;
height: 100px;
width: var(--wh);
height: var(--wh);
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -36,19 +47,19 @@ body {
}

.theme-default.light {
background-color: #DEE3E6;
background-color: #dee3e6;
}

.theme-default.dark {
background-color: #8CA2AD;
background-color: #8ca2ad;
}

.theme-candy.light {
background-color: #F9E3E3;
background-color: #f9e3e3;
}

.theme-candy.dark {
background-color: #F9C3C3;
background-color: #f9c3c3;
}

.theme-wood.light {
Expand All @@ -72,12 +83,28 @@ body {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
flex-shrink: 1;
max-height: 100%;
}

.game-container {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 4%;
}

.btn-container {
position: absolute;
bottom: -7%;
display: flex;
width: 100%;
justify-content: space-around;
}

.highlight {
/* put a small black circle in the middle of the square */
background-image: radial-gradient(circle, black 5%, transparent 30%);
Expand Down Expand Up @@ -109,25 +136,27 @@ body {

.my-swal {
background-color: green;
background: rgba(255, 255, 255, .5);
background: rgba(255, 255, 255, 0.5);
}

.button {
appearance: none;
background-color: #FAFBFC;
background-color: #fafbfc;
border: 1px solid rgba(27, 31, 35, 0.15);
border-radius: 6px;
box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0, rgba(255, 255, 255, 0.25) 0 1px 0 inset;
box-shadow: rgba(27, 31, 35, 0.04) 0 1px 0,
rgba(255, 255, 255, 0.25) 0 1px 0 inset;
box-sizing: border-box;
color: #24292E;
color: #24292e;
cursor: pointer;
display: inline-block;
font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial,
sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
font-size: 14px;
font-weight: 500;
line-height: 20px;
list-style: none;
padding: 6px 16px;
padding: 1% 2.5%;
position: relative;
transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
user-select: none;
Expand All @@ -139,20 +168,20 @@ body {
}

.button:hover {
background-color: #F3F4F6;
background-color: #f3f4f6;
text-decoration: none;
transition-duration: 0.1s;
}

.button:disabled {
background-color: #FAFBFC;
background-color: #fafbfc;
border-color: rgba(27, 31, 35, 0.15);
color: #959DA5;
color: #959da5;
cursor: default;
}

.button:active {
background-color: #EDEFF2;
background-color: #f2eded;
box-shadow: rgba(225, 228, 232, 0.2) 0 1px 0 inset;
transition: none 0s;
}
Expand Down Expand Up @@ -195,3 +224,26 @@ body {
.github-fork-ribbon:before {
background-color: #000;
}

/* Desktop */
@media only screen and (max-width: 1920px) {
:root {
--wh: 85px;
}
.button {
font-size: 16px;
padding: 1% 3%;
}
}

/* Laptop */
@media only screen and (max-width: 1280px) {
:root {
--wh: 45px;
}

.button {
font-size: 10px;
padding: 0.5% 1.5%;
}
}