Skip to content

Commit

Permalink
Merge pull request #111 from TYPO3incubator/task/game-teaser
Browse files Browse the repository at this point in the history
Implement game teaser slider and table view
  • Loading branch information
pixeldesu authored Apr 12, 2024
2 parents b4bdba5 + 771c94f commit 34714e5
Show file tree
Hide file tree
Showing 12 changed files with 761 additions and 28 deletions.
10 changes: 10 additions & 0 deletions local_packages/football/Resources/Private/JavaScript/Src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import * as bootstrap from 'bootstrap';
import Splide from '@splidejs/splide';

const dropdownElementList = document.querySelectorAll('[data-bs-toggle="dropdown"]')
const dropdownList = [...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl))

const collapseElementList = document.querySelectorAll('[data-bs-toggle="collapse"]')
const collapseList = [...collapseElementList].map(collapseEl => new bootstrap.Collapse(collapseEl))

new Splide( '.splide', {
perPage: 3,
breakpoints: {
768: {
perPage: 1,
},
}
}).mount();
16 changes: 16 additions & 0 deletions local_packages/football/Resources/Private/Scss/Elements/_game.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.game-slider-image {
max-height: 100px;
width: auto;
}

.game-slider-image-small {
max-height: 2.5rem;
padding-inline: 10px;
width: auto;
}

.game-score {
color: $color__primary;
font-size: 2.5rem;
font-weight: bolder;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
@import "search";
@import "form";
@import "news";
@import "game";
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@import 'bootstrap/scss/modal';
@import 'bootstrap/scss/nav';
@import 'bootstrap/scss/navbar';
@import 'bootstrap/scss/tables';
@import 'bootstrap/scss/transitions';

// mixins
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import "bootstrap";
@import "bootstrap";
@import "splide";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "@splidejs/splide/dist/css/splide.min";
Original file line number Diff line number Diff line change
@@ -1,25 +1,90 @@
<html data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">

<h3>{data.header}</h3>
<span>{data.game_results_mode}</span>

<!--- for data structure have a look at Resources/Public/Data/matches.json -->
<f:for each="{results}" as="result">
<div>
{result.homeTeam.name} : {result.awayTeam.name}<br />
<f:format.date date="{result.datetime}" format="d.m.Y" /><br />
{result.location}<br />
<f:if condition="{result.result}">
<f:then>
{result.result.home} : {result.result.away}
</f:then>
<f:else>
not played yet
</f:else>
</f:if>
<br /><br />
</div>
</f:for>

</html>
<html data-namespace-typo3-fluid="true"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">

<f:if condition="{data.game_results_mode} == 'slider'">
<f:then>
<f:render section="ResultsSlider" arguments="{_all}"></f:render>
</f:then>
<f:else>
<f:render section="ResultsTable" arguments="{_all}"></f:render>
</f:else>
</f:if>

<f:section name="ResultsSlider">
<section class="splide" aria-labelledby="carousel-heading">
<h3 id="carousel-heading">{data.header}</h3>

<div class="splide__track">
<ul class="splide__list">
<f:for each="{results}" as="result">
<li class="splide__slide text-center">
<div class="d-flex align-items-center justify-content-around my-4">
<img class="game-slider-image" src="{result.homeTeam.iconUrl}" alt="{result.homeTeam.name}"/>
<div class="game-score">
<f:if condition="{result.result}">
<f:then>
{result.result.home} : {result.result.away}
</f:then>
<f:else>
TBA
</f:else>
</f:if>
</div>
<img class="game-slider-image" src="{result.awayTeam.iconUrl}" alt="{result.awayTeam.name}"/>
</div>
<div class="font-italic text-muted">
{result.meta.league} @ {result.location}
</div>
<time datetime="{result.datetime}">
<f:format.date date="{result.datetime}" format="d.m.Y" />
</time>
</li>
</f:for>
</ul>
</div>
</section>
</f:section>

<f:section name="ResultsTable">
<div class="table-responsive">
<table class="table table-bordered align-middle">
<tbody>
<f:for each="{results}" as="result">
<tr class="text-center {f:if(condition: '!{result.result}', then: 'opacity-50 pe-none')}">
<td>
<time class="fw-bold" datetime="{result.datetime}">
<f:format.date date="{result.datetime}" format="d.m.Y" />
</time>
</td>
<td>
<div class="d-flex align-items-center justify-content-center mb-2">
<img class="game-slider-image-small" src="{result.homeTeam.iconUrl}" alt="{result.homeTeam.name}"/>
<div class="game-score">
<f:if condition="{result.result}">
<f:then>
{result.result.home} : {result.result.away}
</f:then>
<f:else>
TBA
</f:else>
</f:if>
</div>
<img class="game-slider-image-small" src="{result.awayTeam.iconUrl}" alt="{result.awayTeam.name}"/>
</div>
</td>
<td>
<div class="fw-bold">
{result.meta.league}
</div>
<div class="text-muted">
{result.location}
</div>
</td>
</tr>
</f:for>
</tbody>
</table>
</div>
</f:section>

</html>
Loading

0 comments on commit 34714e5

Please sign in to comment.