Browse Source

- Added external links to the bottom of the details panel

pull/1/head
Quildra 1 year ago
parent
commit
267915eb40
  1. 97
      src/app/features/pokemon/pokemon-details/pokemon-details.component.ts

97
src/app/features/pokemon/pokemon-details/pokemon-details.component.ts

@ -27,40 +27,51 @@ import { Observable } from 'rxjs';
<div class="details-content"> <div class="details-content">
<img <img
[src]="'/assets/images/pokemon/' + pokemon?.Image" [src]="pokemon?.Image"
[alt]="pokemon?.Name" [alt]="pokemon?.Name"
class="pokemon-detail-image" class="pokemon-detail-image"
> >
<div class="encounters-section"> <div class="scrollable-content">
<h3>Encounters</h3> <div class="encounters-section">
<ng-container *ngIf="encounters$ | async as encounters"> <h3>Encounters</h3>
<div *ngFor="let gameGroup of groupEncountersByGame(encounters)" class="game-encounters"> <ng-container *ngIf="encounters$ | async as encounters">
<button <div *ngFor="let gameGroup of groupEncountersByGame(encounters)" class="game-encounters">
class="collapsible" <button
(click)="toggleCollapsible($event)" class="collapsible"
[class.active]="isCollapsibleActive" (click)="toggleCollapsible($event)"
> [class.active]="isCollapsibleActive"
{{ gameGroup.game }} >
<span class="toggle-icon"></span> {{ gameGroup.game }}
</button> <span class="toggle-icon"></span>
<div class="encounter-list"> </button>
<div *ngFor="let encounter of gameGroup.encounters" class="encounter-item"> <div class="encounter-list">
<p> <div *ngFor="let encounter of gameGroup.encounters" class="encounter-item">
{{ encounter.location }} <p>
<ng-container *ngIf="encounter.day || encounter.time"> {{ encounter.location }}
({{ encounter.day || '' }} {{ encounter.time || '' }}) <ng-container *ngIf="encounter.day || encounter.time">
</ng-container> ({{ encounter.day || '' }} {{ encounter.time || '' }})
</p> </ng-container>
<div class="encounter-tags"> </p>
<span *ngIf="encounter.static_encounter" class="tag">Static</span> <div class="encounter-tags">
<span *ngIf="encounter.fishing" class="tag">Fishing</span> <span *ngIf="encounter.static_encounter" class="tag">Static</span>
<span *ngIf="encounter.starter" class="tag">Starter</span> <span *ngIf="encounter.fishing" class="tag">Fishing</span>
<span *ngIf="encounter.starter" class="tag">Starter</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </ng-container>
</ng-container> </div>
</div>
<div class="external-links">
<a
[href]="'https://bulbapedia.bulbagarden.net/wiki/' + pokemon?.Name + '_(Pokémon)'"
target="_blank"
rel="noopener noreferrer"
>
View on Bulbapedia
</a>
</div> </div>
</div> </div>
</div> </div>
@ -76,7 +87,7 @@ import { Observable } from 'rxjs';
right: -340px; right: -340px;
bottom: 0; bottom: 0;
transition: right 0.3s ease-in-out; transition: right 0.3s ease-in-out;
overflow-y: auto; overflow: hidden;
z-index: 1000; z-index: 1000;
} }
@ -102,6 +113,7 @@ import { Observable } from 'rxjs';
object-fit: contain; object-fit: contain;
margin: 0 auto 20px; margin: 0 auto 20px;
display: block; display: block;
flex-shrink: 0; /* Prevent image from shrinking */
} }
.game-encounters { .game-encounters {
@ -163,6 +175,35 @@ import { Observable } from 'rxjs';
font-size: 0.8em; font-size: 0.8em;
color: #666; color: #666;
} }
.details-content {
display: flex;
flex-direction: column;
height: 100%;
}
.scrollable-content {
flex: 1;
overflow-y: auto;
}
.external-links {
position: sticky;
bottom: 0; /* Ensures it's always at the bottom of the panel */
padding: 15px;
border-top: 1px solid #eee;
background: white;
z-index: 10; /* Keeps it above the scrollable content */
a {
color: #0645ad;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}
`] `]
}) })
export class PokemonDetailsComponent { export class PokemonDetailsComponent {

Loading…
Cancel
Save