mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
167 lines
2.8 KiB
SCSS
167 lines
2.8 KiB
SCSS
@mixin move-indicator {
|
|
border-radius: 50%;
|
|
content: "";
|
|
display: block;
|
|
height: 2vmin;
|
|
position: absolute;
|
|
right: 2vmin;
|
|
width: 2vmin;
|
|
}
|
|
|
|
.board {
|
|
background: lighten($black-square-color, 7%);
|
|
border-collapse: unset;
|
|
border-radius: 2vmin;
|
|
border-spacing: 1px;
|
|
box-shadow: 0 0.5vmin 3vmin rgba(0, 0, 0, 0.4);
|
|
color: $white-square-color;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 90vmin;
|
|
position: relative;
|
|
table-layout: fixed;
|
|
width: 90vmin;
|
|
|
|
&.white-to-move:before {
|
|
@include move-indicator;
|
|
background: #fff;
|
|
}
|
|
|
|
&.black-to-move:before {
|
|
@include move-indicator;
|
|
background: #000;
|
|
}
|
|
|
|
&.player-is-white.white-to-move:before,
|
|
&.player-is-black.black-to-move:before {
|
|
bottom: 2vmin;
|
|
}
|
|
|
|
&.player-is-white.black-to-move:before,
|
|
&.player-is-black.white-to-move:before {
|
|
top: 2vmin;
|
|
}
|
|
}
|
|
|
|
.board-header,
|
|
.board-footer {
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.board-border-bottom-middle {
|
|
flex: 1;
|
|
}
|
|
|
|
.board-body {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: row;
|
|
|
|
.board-border-left,
|
|
.board-border-right {
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.board-ranks {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.board-rank {
|
|
flex: 1;
|
|
display: flex;
|
|
}
|
|
|
|
.board-border-left,
|
|
.board-border-right {
|
|
width: 5vmin;
|
|
}
|
|
|
|
.board-border-top,
|
|
.board-border-bottom {
|
|
height: 5vmin;
|
|
}
|
|
|
|
.board-square {
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
background-size: 100%;
|
|
border-radius: 0.25vmin;
|
|
flex: 1;
|
|
margin: 0.5px;
|
|
|
|
// This is to ensure the squares can be clicked on in PhantomJS
|
|
// TODO: Figure out why we need this
|
|
min-width: 2vmin;
|
|
min-height: 2vmin;
|
|
|
|
@each $colour in $colours {
|
|
@each $piece in $pieces {
|
|
&.#{$colour}.#{$piece} {
|
|
background-image: url(/images/#{$piece}_#{$colour}.svg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@mixin black-square {
|
|
background-color: $black-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($black-square-color, $selected-square-color, 60%);
|
|
outline: 0.2vmin solid $selected-outline-color;
|
|
}
|
|
}
|
|
|
|
@mixin white-square {
|
|
background-color: $white-square-color;
|
|
|
|
&.selected {
|
|
background-color: mix($white-square-color, $selected-square-color, 60%);
|
|
outline: 0.2vmin solid $selected-outline-color;
|
|
}
|
|
}
|
|
|
|
.board-rank:nth-child(odd) {
|
|
.board-square:nth-child(even) {
|
|
@include black-square;
|
|
}
|
|
|
|
.board-square:nth-child(odd) {
|
|
@include white-square;
|
|
}
|
|
}
|
|
|
|
.board-rank:nth-child(even) {
|
|
.board-square:nth-child(even) {
|
|
@include white-square;
|
|
}
|
|
|
|
.board-square:nth-child(odd) {
|
|
@include black-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;
|
|
}
|
|
}
|