Skip to content

Commit

Permalink
Style for CityCards; make animations constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoppa committed Nov 12, 2017
1 parent b3b1027 commit d452875
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/app/city/city-card.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-card>
<mat-card class="city-card">
<h2>{{searchedCity.city | uppercase}}</h2>
<h4>{{searchedCity.country | uppercase}}</h4>
<p *ngFor="let aqi of aqis">
Expand Down
22 changes: 2 additions & 20 deletions src/app/city/city-cards-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { trigger, transition, style, animate, state } from '@angular/animations';
import { FadeSlideAnimation } from '../shared/animations/fade-slide-animation.constant';
import {BrowserModule} from '@angular/platform-browser'
import {BrowserAnimationsModule} from '@angular/platform-browser/animations'

Expand All @@ -10,25 +10,7 @@ import { SearchedCity } from '../search/searched-city.model';
selector: 'aq-city-cards-list',
templateUrl: './city-cards-list.component.html',
animations: [
trigger(
'fadeSlide',
[
transition(
':enter',
[
style({transform: 'translateY(-100%)', opacity: 0}),
animate('300ms', style({transform: 'translateY(0)', 'opacity': 1}))
]
),
transition(
':leave',
[
style({transform: 'translateY(0)', 'opacity': 1}),
animate('300ms', style({transform: 'translateY(-100%)', 'opacity': 0}))
]
)
]
)
FadeSlideAnimation
]
})
export class CityCardsListComponent implements OnInit {
Expand Down
3 changes: 1 addition & 2 deletions src/app/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ interface ValidationResult {

@Injectable()
export class SearchService {
public validateSearchInput(control: FormControl): ValidationResult {

public validateSearchInput(control: FormControl): ValidationResult {
return null;
}

Expand Down
21 changes: 21 additions & 0 deletions src/app/shared/animations/fade-slide-animation.constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { trigger, transition, style, animate, state, AnimationTriggerMetadata } from '@angular/animations';

export const FadeSlideAnimation: AnimationTriggerMetadata = trigger(
'fadeSlide',
[
transition(
':enter',
[
style({transform: 'translateY(-100%)', opacity: 0}),
animate('300ms', style({transform: 'translateY(0)', 'opacity': 1}))
]
),
transition(
':leave',
[
style({transform: 'translateY(0)', 'opacity': 1}),
animate('300ms', style({transform: 'translateY(-100%)', 'opacity': 0}))
]
)
]
)
3 changes: 2 additions & 1 deletion src/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@

// 6. Page-specific styles
@import
'modules/city/city-card.component',
'modules/home/home.component',
'modules/shared/material/_mat-spinner.component.scss';
'modules/search/search.component';

// 7. Shame (should eventually be empty)
@import
Expand Down
3 changes: 3 additions & 0 deletions src/sass/modules/city/_city-card.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mat-card.city-card {
margin: 10px;
}

0 comments on commit d452875

Please sign in to comment.