Skip to content
Snippets Groups Projects
Commit 263cbcc2 authored by Helmut's avatar Helmut
Browse files

Initial Commit

parent d7d85dd7
No related branches found
No related tags found
No related merge requests found
/* HeroesComponent's private CSS styles */
.selected {
background-color: blue !important;
color: white;
}
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.heroes li {
cursor: pointer;
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
padding: .3em 0;
height: 1.6em;
border-radius: 4px;
}
.heroes li.selected:hover {
background-color: #BBD8DC !important;
color: white;
}
.heroes li:hover {
color: #607D8B;
background-color: #DDD;
left: .1em;
}
.heroes .text {
position: relative;
top: -3px;
size: 100px;
}
.heroes .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.4em 0.7em 0 0.7em;
background-color: #607D8B;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
<div class="container-fluid">
<h2>My Heroes</h2>
<div class="heroes row">
<div class="col-md-4 col-sm-6 col-12" *ngFor="let hero of heroes"
[class.selected]="hero === selectedHero"
(click)="onSelect(hero, $event)">
<span class="text">{{hero.name}}</span>
</div>
</div>
<app-hero-detail [hero]="selectedHero"></app-hero-detail>
<div class="row">
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
</div>
<div>
<div class="row heroes ">
<div class="column is-one-third col-xs-6 col-md-4" *ngFor="let hero of heroes; let index = index">
<div class="green"> green- {{index}} </div>
<div class ="row blue" *ngIf="(index + 1) % 3 == 0"> blue - {{index}} </div>
</div>
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeroesComponent } from './heroes.component';
import { HEROES } from '../mock-heroes';
describe('HeroesComponent', () => {
let component: HeroesComponent;
let fixture: ComponentFixture<HeroesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HeroesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HeroesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Hero } from '../hero';
import { HEROES } from '../mock-heroes';
import {Event} from '@angular/router';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.css']
})
export class HeroesComponent implements OnInit {
heroes = HEROES;
selectedHero: Hero;
onSelect(hero: Hero, event: Event): void {
this.selectedHero = hero;
// Log the mouse event details
console.dir( event );
}
constructor() { }
ngOnInit() {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment