Placeholder image/logo for recipes without mainImages.
This commit is contained in:
parent
14acdc3e83
commit
09490514b1
@ -40,8 +40,6 @@
|
|||||||
[height]="recipe.mainImage!.height"
|
[height]="recipe.mainImage!.height"
|
||||||
[width]="recipe.mainImage!.width"
|
[width]="recipe.mainImage!.width"
|
||||||
/>
|
/>
|
||||||
} @else {
|
|
||||||
<p>!! Placeholder todo !!</p>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div [innerHTML]="recipe.text"></div>
|
<div [innerHTML]="recipe.text"></div>
|
||||||
|
|||||||
13
src/app/shared/components/logo/logo.css
Normal file
13
src/app/shared/components/logo/logo.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
div {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: var(--primary-red);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.utensils {
|
||||||
|
color: var(--primary-white);
|
||||||
|
}
|
||||||
3
src/app/shared/components/logo/logo.html
Normal file
3
src/app/shared/components/logo/logo.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
<fa-icon [icon]="faUtensils" size="2x" class="utensils"></fa-icon>
|
||||||
|
</div>
|
||||||
23
src/app/shared/components/logo/logo.spec.ts
Normal file
23
src/app/shared/components/logo/logo.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Logo } from './logo';
|
||||||
|
|
||||||
|
describe('Logo', () => {
|
||||||
|
let component: Logo;
|
||||||
|
let fixture: ComponentFixture<Logo>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Logo]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Logo);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
await fixture.whenStable();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
13
src/app/shared/components/logo/logo.ts
Normal file
13
src/app/shared/components/logo/logo.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { faUtensils } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-logo',
|
||||||
|
imports: [FaIconComponent],
|
||||||
|
templateUrl: './logo.html',
|
||||||
|
styleUrl: './logo.css',
|
||||||
|
})
|
||||||
|
export class Logo {
|
||||||
|
protected readonly faUtensils = faUtensils;
|
||||||
|
}
|
||||||
@ -4,6 +4,15 @@
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.recipe-card-image-placeholder {
|
||||||
|
height: 200px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
article {
|
article {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@ -4,9 +4,11 @@
|
|||||||
@if (mainImage.isSuccess()) {
|
@if (mainImage.isSuccess()) {
|
||||||
@let maybeMainImageUrl = mainImage.data();
|
@let maybeMainImageUrl = mainImage.data();
|
||||||
@if (!!maybeMainImageUrl) {
|
@if (!!maybeMainImageUrl) {
|
||||||
<img [src]="mainImage.data()" id="recipe-card-image" [alt]="recipe.mainImage?.alt" />
|
<img [src]="maybeMainImageUrl" id="recipe-card-image" [alt]="recipe.mainImage!.alt" />
|
||||||
} @else {
|
} @else {
|
||||||
<p>!! Placeholder todo !!</p>
|
<div class="recipe-card-image-placeholder">
|
||||||
|
<app-logo></app-logo>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@ -5,10 +5,11 @@ import { injectQuery } from '@tanstack/angular-query-experimental';
|
|||||||
import { ImageService } from '../../../services/ImageService';
|
import { ImageService } from '../../../services/ImageService';
|
||||||
import { faGlobe, faLock, faStar, faUser } from '@fortawesome/free-solid-svg-icons';
|
import { faGlobe, faLock, faStar, faUser } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { Logo } from '../../logo/logo';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-recipe-card',
|
selector: 'app-recipe-card',
|
||||||
imports: [RouterLink, FaIconComponent],
|
imports: [RouterLink, FaIconComponent, Logo],
|
||||||
templateUrl: './recipe-card.html',
|
templateUrl: './recipe-card.html',
|
||||||
styleUrl: './recipe-card.css',
|
styleUrl: './recipe-card.css',
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user