mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
161 lines
3.6 KiB
SCSS
161 lines
3.6 KiB
SCSS
$board-size: 90vmin;
|
|
|
|
@mixin move-indicator {
|
|
border-radius: 50%;
|
|
content: "";
|
|
display: block;
|
|
height: 2%;
|
|
position: absolute;
|
|
right: 2%;
|
|
width: 2%;
|
|
}
|
|
|
|
.board {
|
|
background: lighten($black-square-color, 7%);
|
|
border-collapse: unset;
|
|
border-radius: 2.8%;
|
|
border-spacing: 1px;
|
|
box-shadow: 0 ($board-size / 200) ($board-size / 40) $board-shadow-color;
|
|
color: $white-square-color;
|
|
height: $board-size;
|
|
padding: $board-size / 20;
|
|
position: relative;
|
|
width: $board-size;
|
|
|
|
&.white-to-move::before {
|
|
@include move-indicator;
|
|
background: $white;
|
|
}
|
|
|
|
&.black-to-move::before {
|
|
@include move-indicator;
|
|
background: $black;
|
|
}
|
|
|
|
&.player-is-white.white-to-move::before,
|
|
&.player-is-black.black-to-move::before {
|
|
bottom: 2%;
|
|
}
|
|
|
|
&.player-is-white.black-to-move::before,
|
|
&.player-is-black.white-to-move::before {
|
|
top: 2%;
|
|
}
|
|
}
|
|
|
|
.board-body {
|
|
display: grid;
|
|
grid-template-columns: repeat(8, 1fr);
|
|
grid-template-rows: repeat(8, 1fr);
|
|
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
|
|
.board-border-top,
|
|
.board-border-bottom {
|
|
height: $board-size / 20;
|
|
}
|
|
|
|
%black-square {
|
|
background-color: $black-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($black-square-color, $selected-square-color, 60%);
|
|
box-shadow: 0 0 0 ($board-size / 400) $selected-outline-color;
|
|
}
|
|
|
|
&.available {
|
|
background-color: mix($black-square-color, $available-square-color, 80%);
|
|
box-shadow: 0 0 0 ($board-size / 400) $available-outline-color;
|
|
}
|
|
}
|
|
|
|
%white-square {
|
|
background-color: $white-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($white-square-color, $selected-square-color, 60%);
|
|
box-shadow: 0 0 0 ($board-size / 400) $selected-outline-color;
|
|
}
|
|
|
|
&.available {
|
|
background-color: mix($white-square-color, $available-square-color, 80%);
|
|
box-shadow: 0 0 0 ($board-size / 400) $available-outline-color;
|
|
}
|
|
}
|
|
|
|
.board-square {
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
background-size: 100%;
|
|
border-radius: 2%;
|
|
margin: 0.5px;
|
|
|
|
// This is to ensure the squares can be clicked on in PhantomJS
|
|
// TODO: Figure out why we need this
|
|
|
|
min-height: 20px;
|
|
min-width: 20px;
|
|
|
|
@include odd-between(1, 8) { @extend %white-square; }
|
|
@include even-between(1, 8) { @extend %black-square; }
|
|
|
|
@include odd-between(9, 16) { @extend %black-square; }
|
|
@include even-between(9, 16) { @extend %white-square; }
|
|
|
|
@include odd-between(17, 24) { @extend %white-square; }
|
|
@include even-between(17, 24) { @extend %black-square; }
|
|
|
|
@include odd-between(25, 32) { @extend %black-square; }
|
|
@include even-between(25, 32) { @extend %white-square; }
|
|
|
|
@include odd-between(33, 40) { @extend %white-square; }
|
|
@include even-between(33, 40) { @extend %black-square; }
|
|
|
|
@include odd-between(41, 48) { @extend %black-square; }
|
|
@include even-between(41, 48) { @extend %white-square; }
|
|
|
|
@include odd-between(49, 56) { @extend %white-square; }
|
|
@include even-between(49, 56) { @extend %black-square; }
|
|
|
|
@include odd-between(57, 64) { @extend %black-square; }
|
|
@include even-between(57, 64) { @extend %white-square; }
|
|
|
|
@each $colour in $colours {
|
|
@each $piece in $pieces {
|
|
&.#{$colour}.#{$piece} {
|
|
background-image: url(/images/#{$piece}_#{$colour}.svg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// .board-square:nth-child(even) {
|
|
// @include black-square;
|
|
// }
|
|
|
|
// .board-square:nth-child(odd) {
|
|
// @include white-square;
|
|
// }
|
|
|
|
@media (min-width: 480px) {
|
|
.board-square {
|
|
margin: 1px;
|
|
}
|
|
|
|
.board-label {
|
|
font-size: 0.8rem;
|
|
}
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
.board-square {
|
|
margin: 1.5px;
|
|
}
|
|
|
|
.board-label {
|
|
font-size: 1rem;
|
|
}
|
|
}
|