Board preview

                @use "../abstracts/css-util";


.boardpreview-container {
   container-type: inline-size;
   container-name: boardpreview;
   width: 100%;
}

.boardpreview {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Open Sans', 'Helvetica Neue', sans-serif !important;
    border-radius: 8rem;
    border: 0.8rem solid #262626;
    background: white;
    width: 100%;
    aspect-ratio: 16 / 9.93;
    display: flex;
    overflow: clip;
    position: relative;

    .team {
        width: 50%;
        justify-content: center;
        align-items: center;
        display: flex;
        flex-direction: column;
    }

    .team-content {
        width: 100%;
        align-items: center;
        justify-content: center;
        display: flex;
        flex-direction: column;
        margin-top: 2rem;

        .team-name {
            font-size: 2.4rem;
            font-weight: 700;
            text-align: center;
        }

        .score {
            font-size: 28rem;
            line-height: 0.94;
            padding: 0;
            font-weight: 500;
        }

        .goalscorers {
            list-style: none;
            font-size: 1.5rem;
            height: 6rem;
            line-height: 1.4;
            font-weight: 500;
            text-align: center;
        }

    }

    .team1 {
        background: orange;
        color: black;
        order: 1;
    }

    .team2 {
        background: black;
        color: white;
        order: 2;
    }

    button {
        position: absolute;
        border-radius: 20rem;
        background: black;
        color: white;
        font-size: 1.2rem;
        display: block;
        border: 1px solid gray;
        width: 5.4rem;
        height: 5.4rem;
        font-variant-numeric: tabular-nums;
        cursor: default !important;

        &.subtract-point {
            font-size: 1.8rem;
            bottom: 3.6rem;

            &-team1 {
                left: 3.6rem;
            }

            &-team2 {
                right: 3.6rem;
            }
        }

        &.swap {
            top: 50%;
            left: 50%;
            margin-left: -2.7rem;
            margin-top: -2.7rem;
            line-height: 0;

            img {
                width:70%;
            }
        }

        &.reset {
            bottom: 10rem;
            left: 50%;
            margin-left: -2.7rem;
            margin-top: -2.7rem;
            line-height: 0;
        }
    }

    .clock {
        position: absolute;
        width: 14rem;
        height: 6rem;
        background: black;
        border-radius: 20rem;
        border: 2px solid gray;
        bottom: 1.8rem;
        left: 50%;
        margin-left: -7rem;
        color: white;
        font-size: 4rem;
        display: flex;
        justify-content: center;
        align-items: center;
        font-variant-numeric: tabular-nums;
    }

    .timer {
        position: absolute;
        width: 20rem;
        height: 5rem;
        background: black;
        border-radius: 20rem;
        border: 1px solid gray;
        top: 1.8rem;
        left: 50%;
        margin-left: -10rem;
        color: white;
        font-size: 2.8rem;
        display: flex;
        justify-content: center;
        align-items: center;
        font-variant-numeric: tabular-nums;
        line-height: 0;
    }
}



@container boardpreview (inline-size < 840px) {
    .boardpreview {

        border-radius: 4rem;

        .team-content {
            scale: 0.9;
        }

        button {
            scale: 0.9;

            &.subtract-point {
                bottom: 1rem;

                &-team1 {
                    left: 1rem;
                }

                &-team2 {
                    right: 1rem;
                }
            }

            &.reset {
                bottom: 8rem
            }
        }

        .clock {
            scale: 0.9;
            bottom: 1rem;
        }

        .timer {
            scale: 0.9;
            top: 1rem;
        }
    }
}


@container boardpreview (inline-size < 780px) {
    .boardpreview {
        border: 0.7rem solid #262626;

        .team-content {
            scale: 0.8;
        }

        button {
            scale: 0.8;

            &.subtract-point {
                bottom: 0.8rem;

                &-team1 {
                    left: 0.8rem;
                }

                &-team2 {
                    right: 0.8rem;
                }
            }

            &.reset {
                bottom: 7.3rem;
            }
        }


        .clock {
            scale: 0.8;
            bottom: 0.8rem;
        }

        .timer {
            scale: 0.8;
            top: 0.8rem;
        }
    }
}


@container boardpreview (inline-size < 580px) {

    .boardpreview {
         border: 0.6rem solid #262626;

        .team-content {
            scale: 0.6;
        }

        button {
            scale: 0.6;

            &.subtract-point {
                bottom: 0.2rem;

                &-team1 {
                    left: 0.2rem;
                }

                &-team2 {
                    right: 0.2rem;
                }
            }

            &.reset {
                bottom: 5.4rem;
            }
        }


        .clock {
            scale: 0.6;
            bottom: 0.2rem;
        }

        .timer {
            scale: 0.6;
            top: 0.2rem;
        }
    }
}



@container boardpreview (inline-size < 440px) {

    .boardpreview {
        border: 0.5rem solid #262626;

        .team-content {
            scale: 0.42;
            margin-top: -4px;
        }

        button {
            scale: 0.42;

            &.subtract-point {
                bottom: 0.2rem;

                &-team1 {
                    left: 0.2rem;
                }

                &-team2 {
                    right: 0.2rem;
                }
            }

            &.reset {
                bottom: 3.4rem;
            }
        }


        .clock {
            scale: 0.42;
            bottom: -0.6rem;
        }

        .timer {
            scale: 0.42;
            top: -0.6rem;
        }
    }
}



            
                function displayTime() {
    const currentTime = new Date();
    const clockDiv = document.querySelector('.clock');

    const options = {
        hour: 'numeric',
        minute: '2-digit',
        hour12: undefined // laat browser bepalen 12h of 24h
    };

    clockDiv.textContent = currentTime.toLocaleTimeString(undefined, options);
}

setInterval(displayTime, 1000);
displayTime();
            
4
2
08:30
Start timer
                
4
2
08:30
Start timer
Team 1
4
Team 2
2
08:30
Start timer
                
Team 1
4
Team 2
2
08:30
Start timer
4
  • Paul (2x)
  • John (1x)
  • Frank (1x)
2
  • Steve (1x)
  • Dave (1x)
08:30
Start timer
                
4
  • Paul (2x)
  • John (1x)
  • Frank (1x)
2
  • Steve (1x)
  • Dave (1x)
08:30
Start timer
Team 1
4
  • Paul (2x)
  • John (1x)
  • Frank (1x)
Team 2
2
  • Steve (1x)
  • Dave (1x)
08:30
Start timer
                
Team 1
4
  • Paul (2x)
  • John (1x)
  • Frank (1x)
Team 2
2
  • Steve (1x)
  • Dave (1x)
08:30
Start timer