Skip to content

Commit

Permalink
differentiat cell colors
Browse files Browse the repository at this point in the history
  • Loading branch information
kiley-mitti committed May 3, 2024
1 parent a325c91 commit 7365977
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
padding: 5px;
}

.odd-day:not(.ruler-new-day-cell) {
background: var(--odd-day-color);
}

.ruler-new-day-display {
display: block;
font-size: var(--font-size-sm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class RuxRuler {
}

render() {
let firstNewDay: number
return (
<Host>
<div class="rux-ruler rux-track">
Expand All @@ -81,11 +82,21 @@ export class RuxRuler {
const newDay = this.timePattern.test(time)
? newDayDate
: ''
if (newDay !== '' && !firstNewDay)
firstNewDay = index

const isOddDay = (index: number) => {
if (firstNewDay) {
return (index - firstNewDay) % 48 <= 23
}
return false
}
return (
<span
key={index}
class={{
'ruler-time': true,
'odd-day': isOddDay(index),
'ruler-new-day-cell': this.shouldShowDate(
time
),
Expand All @@ -95,7 +106,7 @@ export class RuxRuler {
gridColumn: this.getColumn(index),
}}
>
{time}
{time} {firstNewDay ? firstNewDay : null}
{this.shouldShowDate(time) ? (
<span class="ruler-new-day-display">
{newDay}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
}

--grid-line-color: transparent;
--odd-day-color: var(--color-background-surface-selected);
}

:host([show-grid]) {
Expand Down

0 comments on commit 7365977

Please sign in to comment.