Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 9f261bc

Browse files
author
eksrvb
committed
make demo application
1 parent e64c2ac commit 9f261bc

File tree

5 files changed

+52
-14
lines changed

5 files changed

+52
-14
lines changed
Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
1-
<button mat-button (click)="placeholder=!placeholder">switch placeholder</button>
2-
<button mat-button (click)="switchMode()">switch mode: {{mode}}</button>
3-
<p>{{placeholder}}</p>
4-
<calendar-panels
5-
[mode]="mode"
6-
[placeholderDay]="placeholder"
7-
year="2020"
8-
month="5"
9-
monthsBefore="1"
10-
monthsAfter="1"
11-
[config]="calendarConfig">
1+
<div class="selection">
2+
<mat-form-field>
3+
<mat-label>Select Mode</mat-label>
4+
<mat-select [(ngModel)]="mode" name="mode">
5+
<mat-option value="monthly">monthly</mat-option>
6+
<mat-option value="annual">annual</mat-option>
7+
</mat-select>
8+
</mat-form-field>
9+
10+
<mat-slide-toggle [(ngModel)]="placeholder">
11+
Days placeholder
12+
</mat-slide-toggle>
13+
<!-- <mat-slide-toggle [(ngModel)]="calendarConfig.calendarWeek">
14+
Calendar week
15+
</mat-slide-toggle> -->
16+
17+
<mat-form-field>
18+
<mat-label>Months before</mat-label>
19+
<mat-select [(ngModel)]="monthsBefore">
20+
<mat-option *ngFor="let num of monthsAfterBefore" [value]="num">{{num}}</mat-option>
21+
</mat-select>
22+
</mat-form-field>
23+
24+
<mat-form-field>
25+
<mat-label>Months after</mat-label>
26+
<mat-select [(ngModel)]="monthsAfter">
27+
<mat-option *ngFor="let num of monthsAfterBefore" [value]="num">{{num}}</mat-option>
28+
</mat-select>
29+
</mat-form-field>
30+
31+
</div>
32+
33+
<calendar-panels [mode]="mode" [placeholderDay]="placeholder" year="2020" month="5" [monthsBefore]="monthsBefore"
34+
[monthsAfter]="monthsAfter" [config]="calendarConfig">
1235
</calendar-panels>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.selection {
2+
width: 100%;
3+
}
4+
5+
.selection > * {
6+
margin: 12px;
7+
}

projects/my-first-app/src/app/app.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ import { CalendarConfig } from 'projects/material-calendar/src/public-api';
77
styleUrls: ['./app.component.scss']
88
})
99
export class AppComponent {
10-
title = 'my-first-app';
10+
title = 'Material Calendar Demo';
1111

1212
placeholder = false // boolean
1313
mode = 'monthly' // 'annual' | 'monthly'
1414

15+
monthsAfterBefore = Array(11).fill(0).map((x, i) => i);
16+
monthsBefore = 0;
17+
monthsAfter = 0;
18+
1519
calendarConfig: CalendarConfig = {
1620
panelBgColor: '#00677f', // 00677f 006105
1721
autoTextColor: true,
@@ -28,4 +32,4 @@ export class AppComponent {
2832
switchMode() {
2933
this.mode = (this.mode === 'monthly') ? 'annual' : 'monthly'
3034
}
31-
}
35+
}

projects/my-first-app/src/app/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { NgModule, LOCALE_ID } from '@angular/core';
44
import { AppComponent } from './app.component';
55
import { MaterialCalendarModule } from 'projects/material-calendar/src/public-api';
66
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7+
import { MaterialModule } from './material';
8+
import { FormsModule } from '@angular/forms';
79

810
@NgModule({
911
declarations: [
@@ -12,6 +14,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1214
imports: [
1315
BrowserModule,
1416
BrowserAnimationsModule,
17+
MaterialModule,
18+
FormsModule,
1519
MaterialCalendarModule
1620
],
1721
providers: [

projects/my-first-app/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>MyFirstApp</title>
5+
<title>Material Calendar Demo</title>
66
<base href="/">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<link rel="icon" type="image/x-icon" href="favicon.ico">

0 commit comments

Comments
 (0)