Skip to content

Commit

Permalink
$mol_calendar: highlight today
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Sep 28, 2023
1 parent 0af6cf1 commit 2e508cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions calendar/calendar.view.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
color: var(--mol_theme_special);
}

[mol_calendar_today] {
font-weight: bolder;
}

[mol_calendar_ghost] {
opacity: .2;
}
2 changes: 2 additions & 0 deletions calendar/calendar.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $mol_calendar $mol_list
ghost <= day_ghost* false
holiday <= day_holiday* false
selected <= day_selected* false
today <= day_today* false
theme <= day_theme* null
sub <= day_content* /
<= day_text* \
Expand All @@ -37,4 +38,5 @@ $mol_calendar_day $mol_view
mol_calendar_holiday <= holiday false
mol_calendar_ghost <= ghost false
mol_calendar_selected <= selected false
mol_calendar_today <= today false
mol_theme <= theme null
13 changes: 9 additions & 4 deletions calendar/calendar.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,20 @@ namespace $.$$ {
day_holiday( day : string ) {
return this.weekend( new $mol_time_moment( day ).weekday )
}

@ $mol_mem
today() {
return new $mol_time_moment()
}

@ $mol_mem_key
day_ghost( day : string ) {
return new $mol_time_moment( day ).toString( 'YYYY-MM' ) !== this.day_first().toString( 'YYYY-MM' )
day_today( day : string ) {
return this.today().toString( 'YYYY-MM-DD' ) === day
}

@ $mol_mem_key
day_selected( day : string ) {
return new $mol_time_moment().toString( 'YYYY-MM-DD' ) === day
day_ghost( day : string ) {
return new $mol_time_moment( day ).toString( 'YYYY-MM' ) !== this.day_first().toString( 'YYYY-MM' )
}

day_theme( day : string ) {
Expand Down

0 comments on commit 2e508cf

Please sign in to comment.