-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d5501a
commit 6d5fe32
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.monthViewContainer { | ||
padding: 0 1rem; | ||
} | ||
.dayOfWeek { | ||
display: inline-flex; | ||
width: 100%; | ||
justify-content: space-between; | ||
} |
18 changes: 16 additions & 2 deletions
18
libs/pmt-calendar/src/components/month-view/month-view.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import { Component, h, Prop } from "@stencil/core"; | ||
import { DAY_OF_WEEK } from "../../models/calendar.const"; | ||
|
||
@Component({ | ||
tag: 'pmt-month-view', | ||
shadow: true | ||
shadow: true, | ||
styleUrl: 'month-view.scss' | ||
}) | ||
export class MonthViewComponent { | ||
|
||
@Prop() | ||
currentDate: Date; | ||
|
||
readonly DAYS_OF_WEEK = Object.values(DAY_OF_WEEK); | ||
|
||
|
||
|
||
render() { | ||
return ( | ||
<div>{this.currentDate.toLocaleDateString()}</div> | ||
<section class="monthViewContainer"> | ||
<div class="dayOfWeek"> | ||
{this.DAYS_OF_WEEK.map(dow => { | ||
return ( | ||
<div>{dow}</div> | ||
); | ||
})} | ||
</div> | ||
</section> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {getDay} from 'date-fns'; | ||
import { DAY_OF_WEEK } from '../models/calendar.const'; | ||
|
||
export function getDayOfWeekGivenDate(date: Date): string { | ||
const dow = getDay(date); | ||
return DAY_OF_WEEK[dow]; | ||
} |