Add date to clock module
This commit is contained in:
parent
c7bbe801f5
commit
939ccd8a0e
8 changed files with 42 additions and 42 deletions
|
@ -24,7 +24,6 @@
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
|
|
||||||
"src/styles.css"
|
"src/styles.css"
|
||||||
],
|
],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
@import "~@angular/material/prebuilt-themes/purple-green.css";
|
||||||
|
|
||||||
mat-sidenav-container {
|
mat-sidenav-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mat-card-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-card {
|
||||||
|
background-color: pink;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {NgModule} from '@angular/core';
|
import {LOCALE_ID, NgModule} from '@angular/core';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
import {ClockComponent} from './clock/clock.component';
|
import {ClockComponent} from './clock/clock.component';
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
.dashboard-card {
|
@import "../dashboard/card.css";
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
left: 15px;
|
|
||||||
right: 15px;
|
|
||||||
bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dashboard-card-content {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clock {
|
.clock {
|
||||||
font-size: 10rem;
|
font-size: 10rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.date {
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<mat-card class="dashboard-card">
|
<mat-card class="dashboard-card">
|
||||||
<mat-card-content class="dashboard-card-content">
|
<mat-card-content class="dashboard-card-content">
|
||||||
<div class="clock">
|
<div class="clock">
|
||||||
{{hour}}:{{minute | number: '2.0-0'}}
|
{{time}}
|
||||||
|
</div>
|
||||||
|
<div class="date">
|
||||||
|
{{date}}
|
||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {formatDate} from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-clock',
|
selector: 'app-clock',
|
||||||
|
@ -6,8 +7,8 @@ import {Component, OnInit} from '@angular/core';
|
||||||
styleUrls: ['./clock.component.css']
|
styleUrls: ['./clock.component.css']
|
||||||
})
|
})
|
||||||
export class ClockComponent implements OnInit {
|
export class ClockComponent implements OnInit {
|
||||||
hour: number;
|
date: string;
|
||||||
minute: number;
|
time: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
@ -19,8 +20,8 @@ export class ClockComponent implements OnInit {
|
||||||
|
|
||||||
private updateTime() {
|
private updateTime() {
|
||||||
const date = new Date(Date.now());
|
const date = new Date(Date.now());
|
||||||
this.hour = date.getHours();
|
this.date = formatDate(date, 'EEEE, d LLLL yyyy', 'en');
|
||||||
this.minute = date.getMinutes();
|
this.time = formatDate(date, 'H:mm', 'en');
|
||||||
}
|
}
|
||||||
|
|
||||||
private interval() {
|
private interval() {
|
||||||
|
|
11
src/app/dashboard/card.css
Normal file
11
src/app/dashboard/card.css
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
.dashboard-card {
|
||||||
|
position: absolute;
|
||||||
|
top: 15px;
|
||||||
|
left: 15px;
|
||||||
|
right: 15px;
|
||||||
|
bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-card-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -1,21 +1,3 @@
|
||||||
.grid-container {
|
.grid-container {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-card {
|
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
left: 15px;
|
|
||||||
right: 15px;
|
|
||||||
bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.more-button {
|
|
||||||
position: absolute;
|
|
||||||
top: 5px;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dashboard-card-content {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue