Skip to content

Commit

Permalink
Startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarlywebs committed Apr 23, 2024
0 parents commit bf24dd8
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 0 deletions.
51 changes: 51 additions & 0 deletions css/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
*,
*::after,
*::before {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 62.5%; /** font-size 62.5% is equal to 1rem = 10px */
scroll-behavior: smooth;
scroll-padding-top: 15rem;
}
body{
font-size: 1.8rem;
line-height:1.15;
}
div, section, main{
width:100%;
height: auto;
}
nav ul{
list-style:none
}
a, a:active{
text-decoration: unset;
color: #757575;
}
ul, li{
padding:0;
margin:0;
list-style-type: none;
}
img {
display: inline-block;
max-width: 100%;
height: auto;
font-style: italic;
font-size:1.4rem;
background-repeat: no-repeat;
background-size: cover;
}
button{
border: none;
}
hr{
display:block;
height:2px;
width: 100%;
border:0;
background-color: #ffffff;
}
162 changes: 162 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@

body{
font-family: var(--font-family-rubik);
color: var(--textwhite);
background-image: url(/imgs/basketball-playoffs\ 1.jpg);
background-size: cover;
background-repeat: no-repeat;
}
.scoreboard {
display: flex;
justify-content: center;
align-items: start;
width: 835px;
margin: 35rem auto 0;
padding: 3rem 2rem;
background-color: var(--bg);
border: 2px solid var(--stroke);
border-radius: 40px;
box-shadow: 1px 1px 50px 0px rgba(0, 0, 0, 0.75);
}
#scoreboard_home,
#scoreboard_guest {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 3rem;
}
#scoreboard_home h2,
#scoreboard_guest h2{
font-size: var(--font-size-40px);
text-transform: uppercase;
font-weight: 700;
}
#home_score,
#guest_score{
text-align: center;
width: 210px;
height: 190px;
margin: 1rem 0 2rem;
padding-top: 3rem;
font-family: var(--font-family-cursedtimer);
font-size: var(--font-size-130px);
background-color: var(--numberbg);
border-radius: 10px;
color: var(--red)
}
#home_counter,
#guest_counter{
display: flex;
justify-content: space-between;
width: 185px;
}
#home_add1,
#home_add2,
#home_add3,
#guest_add1,
#guest_add2,
#guest_add3{
color: var(--stroke);
font-size: var(--font-size-18px);
border: 2px solid var(--stroke);
padding: 1rem;
border-radius: 5px;
cursor: pointer;
}
#home_add1:hover,
#home_add2:hover,
#home_add3:hover,
#guest_add1:hover,
#guest_add2:hover,
#guest_add3:hover{
color: var(--orange);
border-color: var(--orange);
}


#scoreboard_middle,
#scoreboard_timer_top{
display: flex;
flex-direction: column;
align-items: center;
}
#scoreboard_timer_top {
margin-bottom: -3rem;
}
#scoreboard_bottom{
display: flex;
flex-direction: column;
align-items: center;
}
#scoreboard_timer{
text-align: center;
width: 290px;
height: 90px;
margin: 1rem 0;
padding-top: 1.25rem;
font-family: var(--font-family-cursedtimer);
font-size: var(--font-size-65px);
background-color: var(--numberbg);
border: 2px solid var(--stroke);
border-radius: 10px;
color: var(--red)
}
#scoreboard_fouls{
display: flex;
flex-direction: row;
justify-content: space-between;
}
#scoreboard_period,
#scoreboard_foul_left,
#scoreboard_foul_right{
width: 80px;
display: flex;
flex-direction: column;
align-items: center;
}
#scoreboard_period_score,
#scoreboard_foul_left_score,
#scoreboard_foul_right_score{
text-align: center;
padding: .75rem 2.5rem 0;
font-family: var(--font-family-cursedtimer);
font-size: var(--font-size-50px);
background-color: var(--numberbg);
border: 2px solid var(--stroke);
border-radius: 5px;
color: var(--orange)
}
#scoreboard_period_score {
color: var(--red)
}
#scoreboard_period_title,
#scoreboard_foul_left_title,
#scoreboard_foul_right_title{
font-size: var(--font-size-21px);
text-transform: uppercase;
font-weight: 600;
margin-bottom: .5rem;
}

#scoreboard_reset {
width: 100%;
margin-top: 6rem;
font-size: var(--font-size-26px);
text-transform: uppercase;
font-weight: 700;
color: var(--textwhite);
background-color:unset;
padding: 1.5rem 0;
border: 2px solid var(--stroke);
border-radius: 10px;
cursor: pointer;
}
#scoreboard_reset:hover {
background-color: orange;
}
#scoreboard_game_guide{
font-size: 14.5px;
color: #768094;
margin-top: 2rem;
cursor: pointer;
}
35 changes: 35 additions & 0 deletions css/variables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@font-face {
font-family: 'Cursedtimer';
src: url('/fonts/CursedTimer.woff2') format('woff2');
font-weight: normal;
}
@font-face {
font-family: 'Rubik';
src: url('/fonts/Rubik-Medium.woff2') format('woff2');
font-weight: 600;
}
@font-face {
font-family: 'Rubik';
src: url('/fonts/Rubik-Bold.woff2') format('woff2');
font-weight: 700;
}

:root{
--red: #FF1F47;
--orange:#D98D0D;
--textwhite:#fcfcfc;
--stroke:#3F4451;
--bg:#14161B;
--numberbg:#090909;

--font-size-18px: 1.8rem;
--font-size-21px: 2.1rem;
--font-size-26px: 2.6rem;
--font-size-40px: 4rem;
--font-size-50px: 5rem;
--font-size-65px: 6.5rem;
--font-size-130px: 13rem;

--font-family-cursedtimer: 'Cursedtimer', sans-serif;
--font-family-rubik: 'Rubik', sans-serif;
}
Binary file added fonts/CursedTimer.woff2
Binary file not shown.
Binary file added fonts/Rubik-Bold.woff2
Binary file not shown.
Binary file added fonts/Rubik-Medium.woff2
Binary file not shown.
Binary file added imgs/basketball-playoffs 1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="/css/reset.css"/>
<link rel="stylesheet" type="text/css" href="/css/variables.css"/>
<link rel="stylesheet" type="text/css" href="/css/style.css">

<title>Basketball Counter</title>
</head>

<body>
<div class="scoreboard">
<div id="scoreboard_home">
<h2>HOME</h2>
<p id="home_score">0</p>
<div id="home_counter">
<p id="home_add1">+1</p>
<p id="home_add2">+2</p>
<p id="home_add3">+3</p>
</div>
</div>

<div id="scoreboard_middle">
<div id="scoreboard_timer_top">
<p id="scoreboard_timer">0:00</p>
<div id="scoreboard_period">
<p id="scoreboard_period_title">Period</p>
<p id="scoreboard_period_score">0</p>
</div>
</div>
<div id="scoreboard_bottom">
<div id="scoreboard_fouls">
<div id="scoreboard_foul_left">
<p id="scoreboard_foul_left_title">Foul</p>
<p id="scoreboard_foul_left_score">0</p>
</div>
<div id="scoreboard_foul_right">
<p id="scoreboard_foul_right_title">Foul</p>
<p id="scoreboard_foul_right_score">0</p>
</div>
</div>
<button id="scoreboard_reset">Reset Board</button>
<p id="scoreboard_game_guide">CLICK HERE to learn the game mechanics</p>
</div>

</div>
<div id="scoreboard_guest">
<h2>Guest</h2>
<p id="guest_score">0</p>
<div id="guest_counter">
<p id="guest_add1">+1</p>
<p id="guest_add2">+2</p>
<p id="guest_add3">+3</p>
</div>
</div>
</div>

<script src="js/project.js"></script>
</body>
</html>
80 changes: 80 additions & 0 deletions js/project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

let homeStartScore = 0
let guestStartScore = 0
let homeScore = document.getElementById("home_score");
let guestScore = document.getElementById("guest_score");
let homeAddPoint1 = document.querySelector("#home_add1");
let homeAddPoint2 = document.querySelector("#home_add2");
let homeAddPoint3 = document.querySelector("#home_add3");
let guestAddPoint1 = document.querySelector("#guest_add1");
let guestAddPoint2 = document.querySelector("#guest_add2");
let guestAddPoint3 = document.querySelector("#guest_add3");
homeAddPoint1.onclick = homeAdd1
homeAddPoint2.onclick = homeAdd2
homeAddPoint3.onclick = homeAdd3
guestAddPoint1.onclick = guestAdd1
guestAddPoint2.onclick = guestAdd2
guestAddPoint3.onclick = guestAdd3

function homeAdd1() {
homeStartScore += 1
homeScore.textContent = homeStartScore
addFoulLeft();
}
function homeAdd2() {
homeStartScore += 2
homeScore.textContent = homeStartScore
addFoulLeft();
}
function homeAdd3() {
homeStartScore += 3
homeScore.textContent = homeStartScore
addFoulLeft();
}
function guestAdd1() {
guestStartScore += 1
guestScore.textContent = guestStartScore
addFoulRight();
}
function guestAdd2() {
guestStartScore += 2
guestScore.textContent = guestStartScore
addFoulRight();
}
function guestAdd3() {
guestStartScore += 3
guestScore.textContent = guestStartScore
addFoulRight();
}

let foulScoreLeft = document.getElementById("scoreboard_foul_left_score");
let foulLeftCurrentScore = 0;
let foulScoreRight = document.getElementById("scoreboard_foul_right_score");
let foulRightCurrentScore = 0;

function addFoulLeft() {
if (homeStartScore % 6 === 0) {
foulLeftCurrentScore += 1;
foulScoreLeft.textContent = foulLeftCurrentScore;
}
}
function addFoulRight() {
if (guestStartScore % 6 === 0) {
foulRightCurrentScore += 1;
foulScoreRight.textContent = foulRightCurrentScore;
}
}

let boardReset = document.getElementById("scoreboard_reset");
boardReset.onclick = resetAll

function resetAll() {
homeStartScore = 0
guestStartScore = 0
foulRightCurrentScore = 0
foulLeftCurrentScore = 0
homeScore.textContent = homeStartScore
guestScore.textContent = guestStartScore
foulScoreLeft.textContent = foulLeftCurrentScore
foulScoreRight.textContent = foulRightCurrentScore
}

0 comments on commit bf24dd8

Please sign in to comment.