pmtpenza

Untitled

Jul 5th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2.  
  3. import { NavParamsService } from '../../providers/navParamsService';
  4. import { transformForecast } from '../../providers/transformWeather';
  5. import {
  6. SUN,
  7. THUNDER,
  8. CLOUD,
  9. DRIZZLE,
  10. RAIN,
  11. SNOW
  12. } from '../../constants/weatherIconState';
  13. @Component({
  14. selector: 'app-weather-detail',
  15. templateUrl: './weather-detail.page.html',
  16. styleUrls: ['./weather-detail.page.scss']
  17. })
  18. export class WeatherDetailPage {
  19. private forecastData;
  20. private forecastList;
  21. private currentDay;
  22. private icons = {
  23. [CLOUD]: 'cloud',
  24. [SUN]: 'day-sunny',
  25. [RAIN]: 'rain',
  26. [SNOW]: 'snow',
  27. [THUNDER]: 'day-thunderstorm',
  28. [DRIZZLE]: 'day-showers'
  29. };
  30.  
  31. constructor(private navParamsSrv: NavParamsService) {
  32. this.forecastData = this.navParamsSrv.get('detail');
  33. this.forecastList = transformForecast(this.forecastData);
  34. this.currentDay = this.forecastList.shift();
  35. }
  36.  
  37. getWeatherIconClass(weatherState) {
  38. return this.icons[weatherState];
  39. }
  40.  
  41. getWeatherIcon(weatherState) {
  42. return `wi-${this.getWeatherIconClass(weatherState.weatherState)}`;
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment