Skip to content

Commit f01adf0

Browse files
authored
docs: offer datetime picker (#10)
1 parent 5a8a880 commit f01adf0

File tree

7 files changed

+71
-3
lines changed

7 files changed

+71
-3
lines changed

angular.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
"projects/angular-intl-demo/src/assets"
6969
],
7070
"styles": [
71-
"@angular/material/prebuilt-themes/deeppurple-amber.css",
7271
"node_modules/prismjs/themes/prism-okaidia.css",
7372
"projects/angular-intl-demo/src/styles.scss"
7473
],

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"private": true,
1616
"dependencies": {
17+
"@angular-material-components/datetime-picker": "^9.0.0",
1718
"@angular/animations": "^15.1.0",
1819
"@angular/cdk": "^15.1.5",
1920
"@angular/common": "^15.1.0",

projects/angular-intl-demo/src/app/pipes/date/date.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<div class="fields-container">
2+
<mat-form-field>
3+
<mat-label>Date</mat-label>
4+
<input [(ngModel)]="selectedDate" [ngxMatDatetimePicker]="picker" matInput placeholder="Choose a date">
5+
<mat-datepicker-toggle [for]="$any(picker)" matSuffix></mat-datepicker-toggle>
6+
<ngx-mat-datetime-picker #picker></ngx-mat-datetime-picker>
7+
</mat-form-field>
8+
29
<mat-form-field>
310
<mat-label>Locale</mat-label>
411
<mat-select [(ngModel)]="locale">

projects/angular-intl-demo/src/app/pipes/pipes.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {FormsModule} from "@angular/forms";
1313
import {MatInputModule} from "@angular/material/input";
1414
import {PipesRoutingModule} from "./pipes-routing.module";
1515
import {CountryComponent} from "./country/country.component";
16+
import {NgxMatDatetimePickerModule, NgxMatNativeDateModule} from "@angular-material-components/datetime-picker";
17+
import {MatDatepickerModule} from "@angular/material/datepicker";
1618

1719
@NgModule({
1820
declarations: [
@@ -32,6 +34,9 @@ import {CountryComponent} from "./country/country.component";
3234
MatSelectModule,
3335
FormsModule,
3436
MatInputModule,
37+
NgxMatDatetimePickerModule,
38+
MatDatepickerModule,
39+
NgxMatNativeDateModule,
3540
],
3641
})
3742
export class PipesModule {

projects/angular-intl-demo/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
1111
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1212
</head>
13-
<body class="mat-typography">
13+
<body class="mat-typography mat-app-background">
1414
<app-root></app-root>
1515
</body>
1616
</html>

projects/angular-intl-demo/src/styles.scss

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
1-
/* You can add global styles to this file, and also import other style files */
1+
@use "@angular/material" as mat;
2+
3+
@include mat.core();
4+
5+
$light-theme: mat.define-light-theme((
6+
color: (
7+
primary: mat.define-palette(mat.$deep-purple-palette),
8+
accent: mat.define-palette(mat.$deep-orange-palette),
9+
),
10+
typography: mat.define-typography-config(),
11+
density: 0,
12+
));
13+
14+
$dark-theme: mat.define-dark-theme((
15+
color: (
16+
primary: mat.define-palette(mat.$deep-purple-palette),
17+
accent: mat.define-palette(mat.$deep-orange-palette),
18+
),
19+
));
20+
21+
@include mat.legacy-button-color($light-theme);
22+
@include mat.button-theme($light-theme);
23+
@include mat.toolbar-theme($light-theme);
24+
@include mat.tabs-theme($light-theme);
25+
@include mat.select-theme($light-theme);
26+
@include mat.input-theme($light-theme);
27+
@include mat.datepicker-theme($light-theme);
28+
@include mat.form-field-theme($light-theme);
29+
30+
@media (prefers-color-scheme: dark) {
31+
@include mat.core-color($dark-theme);
32+
@include mat.legacy-button-color($dark-theme);
33+
@include mat.button-color($dark-theme);
34+
@include mat.toolbar-color($dark-theme);
35+
@include mat.tabs-color($dark-theme);
36+
@include mat.select-color($dark-theme);
37+
@include mat.input-color($dark-theme);
38+
@include mat.datepicker-color($dark-theme);
39+
@include mat.form-field-color($dark-theme);
40+
}
241

342
html, body {
443
height: 100%;

0 commit comments

Comments
 (0)