feat(catalog): add anchor IDs to featured groups

This commit is contained in:
ncoronel 2026-08-20 12:46:14 -03:00
parent ce26fb5d1a
commit 92546a28c0
4 changed files with 8 additions and 1 deletions

View File

@ -155,6 +155,7 @@ export type CatalogFeaturedItems =
export interface CatalogFeaturedGroup {
id: number;
code: string;
title: string;
layout: CatalogProductLayout;
group_layout: CatalogGroupLayout;

View File

@ -23,7 +23,7 @@
</p>
} @else {
@for (group of catalog(); track group.id) {
<app-store-section [title]="group.title">
<app-store-section [attr.id]="group.code" [title]="group.title">
<app-product-list
[layout]="group.layout"
[groupLayout]="group.group_layout"

View File

@ -11,6 +11,10 @@ app-store-section + app-store-section {
margin-top: clamp(3rem, 6vw, 5rem);
}
app-store-section[id] {
scroll-margin-top: 8rem;
}
:host > .store-home__additional-info:not(:first-child) {
margin-top: clamp(3rem, 6vw, 5rem);
}

View File

@ -58,6 +58,7 @@ function createCatalog(
return [
{
id: 7,
code: 'destacados',
title: 'Destacados',
layout: 'column_with_image',
group_layout: 'paginated',
@ -149,6 +150,7 @@ describe('StoreHomePageComponent', () => {
const element = fixture.nativeElement as HTMLElement;
expect(catalogServiceStub.getCatalog).not.toHaveBeenCalled();
expect(element.querySelector('app-store-section')?.id).toBe('destacados');
expect(element.querySelector('.store-section__title')?.textContent?.trim()).toBe('Destacados');
expect(element.querySelectorAll('app-product-column-with-image')).toHaveLength(2);
expect(element.textContent).toContain('Auriculares Bluetooth');