add Create HeroSearchComponent
This commit is contained in:
parent
64c40998b9
commit
644139b42c
|
@ -0,0 +1,47 @@
|
|||
/* HeroSearch private styles */
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
font-size: 1.2rem;
|
||||
margin-top: 1rem;
|
||||
margin-bottom: .5rem;
|
||||
|
||||
}
|
||||
input {
|
||||
padding: .5rem;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: #336699 auto 1px;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
}
|
||||
.search-result li a {
|
||||
border-bottom: 1px solid gray;
|
||||
border-left: 1px solid gray;
|
||||
border-right: 1px solid gray;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
padding: .5rem;
|
||||
box-sizing: border-box;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.search-result li a:hover {
|
||||
background-color: #435A60;
|
||||
color: white;
|
||||
}
|
||||
|
||||
ul.search-result {
|
||||
margin-top: 0;
|
||||
padding-left: 0;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<div id="search-component">
|
||||
<label for="search-box">Hero Search</label>
|
||||
<input #searchBox id="search-box" (input)="search(searchBox.value)" />
|
||||
|
||||
<ul class="search-result">
|
||||
<li *ngFor="let hero of heroes$ | async" >
|
||||
<a routerLink="/detail/{{hero.id}}">
|
||||
{{hero.name}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-hero-search',
|
||||
imports: [],
|
||||
templateUrl: './hero-search.component.html',
|
||||
styleUrl: './hero-search.component.css'
|
||||
})
|
||||
export class HeroSearch {
|
||||
|
||||
}
|
Loading…
Reference in New Issue