Skip to content

Commit 894d14c

Browse files
authored
Merge pull request #411 from bruin-tennis-consulting/sticky-carousel
made date header carousel sticky
2 parents a82e93b + 0e4a97c commit 894d14c

5 files changed

Lines changed: 159 additions & 47 deletions

File tree

app/components/Dashboard.js

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -465,31 +465,33 @@ const Dashboard = () => {
465465
onSeasonChange={handleSeasonChange}
466466
/>
467467

468-
<div className={styles.carousel}>
469-
{!seasonFilteredMatches.length
470-
? Array(10)
471-
.fill(0)
472-
.map((_, i) => (
473-
<div
474-
key={i}
475-
className={`${styles.card} ${styles.placeholderCard}`}
476-
/>
477-
))
478-
: uniqueMatches.map((match) => {
479-
const matchKey = match.matchDetails.duel
480-
? `${match.matchDate}#${match.teams.opponentTeam}`
481-
: `_#${match.matchDetails.event}`
482-
483-
return (
484-
<CarouselItem
485-
key={matchKey}
486-
match={match}
487-
logo={logos[match.teams.opponentTeam]}
488-
isSelected={selectedMatchSets.includes(matchKey)}
489-
onClick={handleCarouselClick}
490-
/>
491-
)
492-
})}
468+
<div className={styles.carouselStickyShell}>
469+
<div className={styles.carousel}>
470+
{!seasonFilteredMatches.length
471+
? Array(10)
472+
.fill(0)
473+
.map((_, i) => (
474+
<div
475+
key={i}
476+
className={`${styles.card} ${styles.placeholderCard}`}
477+
/>
478+
))
479+
: uniqueMatches.map((match) => {
480+
const matchKey = match.matchDetails.duel
481+
? `${match.matchDate}#${match.teams.opponentTeam}`
482+
: `_#${match.matchDetails.event}`
483+
484+
return (
485+
<CarouselItem
486+
key={matchKey}
487+
match={match}
488+
logo={logos[match.teams.opponentTeam]}
489+
isSelected={selectedMatchSets.includes(matchKey)}
490+
onClick={handleCarouselClick}
491+
/>
492+
)
493+
})}
494+
</div>
493495
</div>
494496

495497
<div className={styles.mainContent}>

app/components/DashboardTile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const DashboardTile = ({
108108
fontSize: '0.6em',
109109
top: '-0.3em',
110110
left: '0.9em',
111-
letterSpacing: 'normal'
111+
letterSpacing: '0.05em'
112112
}}
113113
>
114114
{tieScores[index]}

app/components/MatchTiles.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ const MatchTiles = ({
4747

4848
// Render function for scores
4949
const renderScore = (score, index, isPlayer1, tieScores) => {
50+
console.log('Rendering score:', {
51+
score,
52+
index,
53+
isPlayer1,
54+
tieScores
55+
})
5056
const lastSetIndex =
5157
player1FinalScores[2].score == null ? 1 : player1FinalScores.length - 1
5258
const isLastSet = index === lastSetIndex
@@ -78,7 +84,7 @@ const MatchTiles = ({
7884
fontSize: '0.6em',
7985
top: '-0.3em',
8086
left: '0.9em',
81-
letterSpacing: 'normal'
87+
letterSpacing: '0.05em'
8288
}}
8389
>
8490
{tieScores[index]}

app/styles/Dashboard.module.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
padding-left: 40px;
1313
padding-right: 40px;
1414
font-family: 'DM Sans', sans-serif;
15-
overflow-x: hidden;
15+
overflow-x: clip;
1616
}
1717

1818
.header {
@@ -124,11 +124,18 @@
124124

125125
/* Carousel of cards (match filtering) */
126126

127+
.carouselStickyShell {
128+
position: sticky;
129+
top: 0;
130+
z-index: 10;
131+
background-color: #ffffff;
132+
margin-bottom: 30px;
133+
}
134+
127135
.carousel {
128136
display: flex;
129137
overflow-x: auto;
130138
scroll-snap-type: x mandatory;
131-
margin-bottom: 30px;
132139
padding: 10px 0;
133140
border-top: 1px solid #dedede;
134141
border-bottom: 1px solid #dedede;
@@ -367,7 +374,7 @@
367374
justify-content: flex-start;
368375
}
369376

370-
.carousel {
377+
.carouselStickyShell {
371378
margin-bottom: 17px;
372379
}
373380
}

package-lock.json

Lines changed: 114 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)