Skip to content

Instantly share code, notes, and snippets.

View NyaGarcia's full-sized avatar
🐈

Nya NyaGarcia

🐈
View GitHub Profile
.card-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 30px;
mat-card {
align-items: center;
display: flex;
flex: 1 0 20%;
.detail {
border-radius: 15px;
box-shadow: 0 0 11px #cacaca;
padding: 30px;
button {
margin-right: 10px;
}
h2 {
form {
display: flex;
flex-direction: column;
}
mat-form-field {
margin: 10px;
}
import { CollectionReference, DocumentData, addDoc, collection, deleteDoc, doc, updateDoc } from '@firebase/firestore';
import { Firestore, collectionData, docData } from '@angular/fire/firestore';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Pokemon } from '../features/pokemon/interfaces/pokemon.interface'; // Don't forget to import the interface!!
@Injectable({
providedIn: 'root',
})
export class PokedexFirestoreService {}
@NyaGarcia
NyaGarcia / pokemon.interface.ts
Last active June 17, 2022 10:55
Exporting the pokemon interface
export interface Pokemon {
height: number;
id: string;
description: string;
imgUrl: string;
name: string;
type: string;
weight: number;
}
import { CommonModule } from '@angular/common';
import { FormComponent } from './components/form/form.component';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { NgModule } from '@angular/core';
import { PokemonComponent } from './pokemon.component';
import { PokemonRoutingModule } from './pokemon-routing.module';
import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
const routes: Routes = [
{
path: '',
loadChildren: () =>
import('./features/pokemon/pokemon.module').then((m) => m.PokemonModule),
},
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Pokemon } from '../../interfaces/pokemon.interface';
@Component({
selector: 'app-detail',
templateUrl: './detail.component.html',
styleUrls: ['./detail.component.scss'],
})
export class DetailComponent implements OnInit {
<div class="detail">
<h2>{{ pokemon.name }}</h2>
<h4>{{ pokemon.type }} type</h4>
<div class="content">
<img [src]="pokemon.imgUrl" />
<div>
<p>Height: {{ pokemon.height }}</p>
<p>Weight: {{ pokemon.weight }}</p>
<p>
{{ pokemon.description }}
.header {
display: flex;
justify-content: center;
img {
height: 150px;
margin-bottom: 60px;
}
}