From 08ff912a7971fee949d5f17e8ff9e64d3b13dee1 Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Wed, 3 Apr 2024 15:59:57 -0600 Subject: [PATCH] Reprototyping of scoreboard without bootstrap carousel --- .../css/live-scoreboard/scoreboard.css | 9 ++++-- .../resources/js/live-scoreboard/carousel.js | 31 +++++++++++++++++++ ProjectSourceCode/src/views/layouts/main.hbs | 2 +- .../src/views/partials/footer.hbs | 18 +++++++++-- .../partials/live-scoreboard/game-card.hbs | 0 .../{ => live-scoreboard}/live-scoreboard.hbs | 0 6 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 ProjectSourceCode/src/resources/js/live-scoreboard/carousel.js create mode 100644 ProjectSourceCode/src/views/partials/live-scoreboard/game-card.hbs rename ProjectSourceCode/src/views/partials/{ => live-scoreboard}/live-scoreboard.hbs (100%) diff --git a/ProjectSourceCode/src/resources/css/live-scoreboard/scoreboard.css b/ProjectSourceCode/src/resources/css/live-scoreboard/scoreboard.css index 113aa50..f01f761 100644 --- a/ProjectSourceCode/src/resources/css/live-scoreboard/scoreboard.css +++ b/ProjectSourceCode/src/resources/css/live-scoreboard/scoreboard.css @@ -1,16 +1,21 @@ +#scoreboard-container { + display: flex; + transition: transform 0.5s ease; + } + .league-container { display: flex; justify-content: flex-start; /* Align cards to the left */ - border: 1px solid rgb(206, 202, 202); } /* Styling for each card representing a live game */ #game-card { + flex: 0 0 auto; border: 1px solid #ccc; padding: 20px; /* Increase padding to increase the apparent height */ margin: 10px 10px; min-height: 100px; /* Set a minimum height for the cards */ + min-width: 150px; box-sizing: border-box; /* Include padding and border in the element's total width and height */ } - diff --git a/ProjectSourceCode/src/resources/js/live-scoreboard/carousel.js b/ProjectSourceCode/src/resources/js/live-scoreboard/carousel.js new file mode 100644 index 0000000..ffb4953 --- /dev/null +++ b/ProjectSourceCode/src/resources/js/live-scoreboard/carousel.js @@ -0,0 +1,31 @@ +document.addEventListener('DOMContentLoaded', function () { + const carouselInner = document.querySelector('#scoreboard-container'); + const carouselItems = Array.from(carouselInner.children); + const carouselControlPrev = document.querySelector('.carousel-control-prev'); + const carouselControlNext = document.querySelector('.carousel-control-next'); + let currentIndex = 0; + + const updateCarousel = () => { + carouselItems.forEach((item, index) => { + if (index === currentIndex) { + item.classList.add('active'); + } else { + item.classList.remove('active'); + } + }); + }; + + carouselControlPrev.addEventListener('click', () => { + if (currentIndex > 0) { + currentIndex--; + updateCarousel(); + } + }); + + carouselControlNext.addEventListener('click', () => { + if (currentIndex < carouselItems.length - 1) { + currentIndex++; + updateCarousel(); + } + }); + }); \ No newline at end of file diff --git a/ProjectSourceCode/src/views/layouts/main.hbs b/ProjectSourceCode/src/views/layouts/main.hbs index 2b179b6..f98d63a 100644 --- a/ProjectSourceCode/src/views/layouts/main.hbs +++ b/ProjectSourceCode/src/views/layouts/main.hbs @@ -1,7 +1,7 @@ - {{> live-scoreboard}} + {{> live-scoreboard/live-scoreboard}} {{> head}} diff --git a/ProjectSourceCode/src/views/partials/footer.hbs b/ProjectSourceCode/src/views/partials/footer.hbs index c5e5e7d..3fbf18d 100644 --- a/ProjectSourceCode/src/views/partials/footer.hbs +++ b/ProjectSourceCode/src/views/partials/footer.hbs @@ -3,6 +3,20 @@ © 2024 - CSCI 3308 Group 6

- - + + + + + + diff --git a/ProjectSourceCode/src/views/partials/live-scoreboard/game-card.hbs b/ProjectSourceCode/src/views/partials/live-scoreboard/game-card.hbs new file mode 100644 index 0000000..e69de29 diff --git a/ProjectSourceCode/src/views/partials/live-scoreboard.hbs b/ProjectSourceCode/src/views/partials/live-scoreboard/live-scoreboard.hbs similarity index 100% rename from ProjectSourceCode/src/views/partials/live-scoreboard.hbs rename to ProjectSourceCode/src/views/partials/live-scoreboard/live-scoreboard.hbs