Skip to content

Commit

Permalink
Range size now no longer depends on compile order
Browse files Browse the repository at this point in the history
Calendar ranges will match day headers in terms of color info

Related to Issue #38
  • Loading branch information
BobChao87 committed Nov 26, 2021
1 parent 5ce9b17 commit 4326271
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions components/calendar/view/Row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
</i18n>
</ElementTableCell>
<ElementTableCell class="range">
<ElementRange class="range-bar" :min="0" :max="24" :start="start" :end="end" />
<ElementRange
class="range-bar"
:class="rangeColor"
:min="0"
:max="24"
:start="start"
:end="end"
/>
</ElementTableCell>
<ElementTableCell class="name">
<ElementLink :to="`/marathon/${marathon.id}`">
Expand Down Expand Up @@ -66,6 +73,14 @@ export default Vue.extend({
}
return durationText;
},
rangeColor(): { 'is-primary': boolean, 'is-info': boolean } {
const now = Date.now();
const isNow = this.marathonStart.getTime() <= now && now <= this.marathonEnd.getTime();
return {
'is-primary': isNow,
'is-info': !isNow,
};
},
todayStart(): Date {
return new Date(this.datetime);
},
Expand All @@ -92,7 +107,8 @@ export default Vue.extend({

<style lang="scss" scoped>
.range-bar {
width: 100px;
max-width: 100px;
min-width: 50px;
}
</style>

Expand Down

0 comments on commit 4326271

Please sign in to comment.