Turn ingredients into inspiration
@if(recipes?.length) {
} @else {
Try searching for ingredients
}
import {
Component,
OnInit,
Input,
OnChanges,
SimpleChanges,
} from '@angular/core';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faAngleLeft, faAngleRight } from '@fortawesome/free-solid-svg-icons';
import { Recipe, RecipeData } from '../../recipes/recipe.model';
import { RecipeService } from '../../services/recipe.service';
import { RecipeCardComponent } from '../../recipes/recipe-card/recipe-card.component';
import { Store, select } from '@ngrx/store';
import { getUserData } from '../../store/auth/auth.selectors';
import { User } from '../../store/auth/user.model';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { HttpParams } from '@angular/common/http';
import { CommonModule } from '@angular/common';
import { Observable, Subject, switchMap, takeUntil } from 'rxjs';
import { ProfileHomeComponent } from '../../user/profile/profile-search/profile-search.component';
@Component({
selector: 'app-carousel',
standalone: true,
imports: [RecipeCardComponent, FontAwesomeModule, CommonModule, RouterModule],
templateUrl: './carousel.component.html',
styleUrl: './carousel.component.scss',
})
export class CarouselComponent implements OnInit, OnChanges {
@Input() carouselType: 'all' | 'user' | 'search' = 'all';
@Input() title: string = '';
@Input() ingredients: string[] = [];
declare user: User | null;
declare faArrowLeft;
declare faArrowRight;
recipes: Recipe[] = [];
pagination: number[] = [];
currentOffset = 0;
currentPage = 0;
recipesCount = 0;
limit = 4;
private unsubscribe$ = new Subject