From 4e30489b6f4883cbcf4e783ef30738396511e172 Mon Sep 17 00:00:00 2001 From: "marcusferl@weifer.de" Date: Thu, 22 Sep 2022 08:52:37 +0200 Subject: [PATCH] vorhersage --- src/app/app.component.html | 3 +- src/app/app.module.ts | 6 ++- .../current-weather-state.component.html | 1 - .../current-weather.component.html | 16 ++++-- .../current-weather.component.scss | 30 ++++++++--- .../current-weather.component.ts | 11 ++-- .../forcast-weather.component.html | 49 ++++++++++++++++- .../forcast-weather.component.scss | 54 +++++++++++++++++++ .../forcast-weather.component.ts | 12 ++++- 9 files changed, 161 insertions(+), 21 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 089b1fd..2f8c0bf 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,3 +1,4 @@
- + +
\ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0144a85..b71498a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -9,6 +9,9 @@ import { ForcastWeatherComponent } from './forcast-weather/forcast-weather.compo import { MatIconModule } from '@angular/material/icon'; import { CurrentWeatherStateComponent } from './current-weather-state/current-weather-state.component'; import { MatGridListModule } from '@angular/material/grid-list'; +import { MatCardModule } from '@angular/material/card'; + + import { HttpClientModule } from '@angular/common/http'; @@ -25,7 +28,8 @@ import { HttpClientModule } from '@angular/common/http'; BrowserAnimationsModule, MatIconModule, MatGridListModule, - HttpClientModule + HttpClientModule, + MatCardModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/current-weather-state/current-weather-state.component.html b/src/app/current-weather-state/current-weather-state.component.html index 8da53a0..e69de29 100644 --- a/src/app/current-weather-state/current-weather-state.component.html +++ b/src/app/current-weather-state/current-weather-state.component.html @@ -1 +0,0 @@ -

current-weather-state works!

diff --git a/src/app/current-weather/current-weather.component.html b/src/app/current-weather/current-weather.component.html index 636ddf8..28f491b 100644 --- a/src/app/current-weather/current-weather.component.html +++ b/src/app/current-weather/current-weather.component.html @@ -1,6 +1,14 @@
-

Aktuell

-

- - + + + Min - Max + + + + + + Max {{weatherData?.calendarDayTemperatureMax?.at(0)}} C° +

Min {{weatherData?.calendarDayTemperatureMin?.at(0)}} C°

+
+
\ No newline at end of file diff --git a/src/app/current-weather/current-weather.component.scss b/src/app/current-weather/current-weather.component.scss index daf349b..0d8dae3 100644 --- a/src/app/current-weather/current-weather.component.scss +++ b/src/app/current-weather/current-weather.component.scss @@ -1,24 +1,38 @@ -.main_container{ - background-color: rgb(0, 0, 0); - border: 1px solid rgb(0, 0, 0); +.main_container { + background-color: rgb(0, 0, 0); + border: 1px solid rgb(0, 0, 0); border-radius: 10px; - width:max-content; + width: max-content; height: max-content; display: flex; flex-direction: column; - padding: 30px; + padding: 10px; justify-content: center; align-items: center; } -.font{ +.font { font-size: 40px; color: white; } -.icon{ - transform:scale(2); +.icon { + transform: scale(2); margin-top: 10px; margin-bottom: 50px; color: white; +} + +.card { + color: white; + font-size: 32px; + + mat-card-title {} +} + +mat-card-title-group { + display: flex; + flex-direction: column; + align-items: center; + } \ No newline at end of file diff --git a/src/app/current-weather/current-weather.component.ts b/src/app/current-weather/current-weather.component.ts index 3f5320b..93caf4d 100644 --- a/src/app/current-weather/current-weather.component.ts +++ b/src/app/current-weather/current-weather.component.ts @@ -7,17 +7,20 @@ import { WeatherApiService } from '../weather-api.service'; templateUrl: './current-weather.component.html', styleUrls: ['./current-weather.component.scss'] }) + export class CurrentWeatherComponent implements OnInit { - constructor(public service: WeatherApiService) { + constructor(public service: WeatherApiService) { } weatherData?: WeatherData ngOnInit(): void { this.service.getData() - .subscribe({next: (response) => { - this.weatherData = response; - }}); + .subscribe({ + next: (response) => { + this.weatherData = response; + } + }); } } diff --git a/src/app/forcast-weather/forcast-weather.component.html b/src/app/forcast-weather/forcast-weather.component.html index 89b91d6..67eb73e 100644 --- a/src/app/forcast-weather/forcast-weather.component.html +++ b/src/app/forcast-weather/forcast-weather.component.html @@ -1 +1,48 @@ -

forcast-weather works!

+
+ + + Vorhersage + + +
+
+ {{weatherData?.dayOfWeek?.at(0)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(0)}}

+ + +
+
+ {{weatherData?.dayOfWeek?.at(1)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(1)}}

+ + +
+
+ {{weatherData?.dayOfWeek?.at(2)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(2)}}

+ + +
+
+ {{weatherData?.dayOfWeek?.at(3)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(3)}}

+ + +
+
+ {{weatherData?.dayOfWeek?.at(4)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(4)}}

+ + +
+
+ {{weatherData?.dayOfWeek?.at(5)?.slice(0,2)}} +

{{weatherData?.calendarDayTemperatureMax?.at(5)}}

+ + +
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/forcast-weather/forcast-weather.component.scss b/src/app/forcast-weather/forcast-weather.component.scss index e69de29..29ae6c3 100644 --- a/src/app/forcast-weather/forcast-weather.component.scss +++ b/src/app/forcast-weather/forcast-weather.component.scss @@ -0,0 +1,54 @@ +.main_container { + margin-top: 20px; + background-color: rgb(0, 0, 0); + border: 1px solid rgb(0, 0, 0); + border-radius: 10px; + width: max-content; + height: max-content; + display: flex; + flex-direction: column; + padding: 10px; + justify-content: center; + align-items: center; +} + +.card { + font-size: 40px; + color: white; + + .content_container_up { + color: white; + font-size: 30px; + display: flex; + flex-direction: row; + margin-top: 20px; + } + + .content_container_mid { + color: white; + font-size: 30px; + display: flex; + flex-direction: row; + text-align: center; + } +} + +.icon { + margin-left: 10px; +} + +.flex { + display: flex; + flex-direction: row; +} + +.container { + display: flex; + flex-direction: column; + margin-right: 10px; + + + border-right: 2px solid white; + border-collapse: separate; + border-spacing: 15px 50px 50px 50px; +} \ No newline at end of file diff --git a/src/app/forcast-weather/forcast-weather.component.ts b/src/app/forcast-weather/forcast-weather.component.ts index 05e146e..a4afcdb 100644 --- a/src/app/forcast-weather/forcast-weather.component.ts +++ b/src/app/forcast-weather/forcast-weather.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit } from '@angular/core'; +import { WeatherData } from '../models/weather.model'; +import { WeatherApiService } from '../weather-api.service'; @Component({ selector: 'app-forcast-weather', @@ -7,9 +9,17 @@ import { Component, OnInit } from '@angular/core'; }) export class ForcastWeatherComponent implements OnInit { - constructor() { } + constructor(public service: WeatherApiService) { } + + weatherData?: WeatherData ngOnInit(): void { + this.service.getData() + .subscribe({ + next: (response) => { + this.weatherData = response; + } + }) } }