import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { faHome, faSearch, faUser, faHeart, faCog, faShoppingCart, faBell, faBookmark } from '@fortawesome/free-solid-svg-icons'; import { BottomNavigationComponent, BottomNavigationItem } from '../../../../../ui-essentials/src/lib/components/navigation/bottom-navigation'; @Component({ selector: 'ui-bottom-navigation-demo', standalone: true, imports: [CommonModule, BottomNavigationComponent, FontAwesomeModule], template: `

Bottom Navigation Demo

Sizes

@for (size of sizes; track size) {

{{ size.toUpperCase() }} Size

}

Variants

@for (variant of variants; track variant) {

{{ variant.charAt(0).toUpperCase() + variant.slice(1) }} Variant

}

With Badges

States

Elevated

With Disabled Item

Interactive Example

Active Item: {{ getActiveItemLabel() }}

Click Count: {{ clickCount }}

Last Clicked: {{ lastClickedItem || 'None' }}

`, styleUrl: './bottom-navigation-demo.component.scss' }) export class BottomNavigationDemoComponent { // FontAwesome icons faHome = faHome; faSearch = faSearch; faUser = faUser; faHeart = faHeart; faCog = faCog; faShoppingCart = faShoppingCart; faBell = faBell; faBookmark = faBookmark; // Demo data sizes = ['sm', 'md', 'lg'] as const; variants = ['default', 'primary', 'secondary'] as const; // Active item tracking for different variants activeItemIds: Record = { sm: 'home', md: 'home', lg: 'home', default: 'home', primary: 'home', secondary: 'home' }; badgeActiveItemId = 'home'; elevatedActiveItemId = 'home'; disabledActiveItemId = 'home'; interactiveActiveItemId = 'home'; // Interactive demo state clickCount = 0; lastClickedItem = ''; isHidden = false; heartBadgeCount = 3; // Item configurations basicItems: BottomNavigationItem[] = [ { id: 'home', label: 'Home', icon: 'home' }, { id: 'search', label: 'Search', icon: 'search' }, { id: 'profile', label: 'Profile', icon: 'profile' }, { id: 'settings', label: 'Settings', icon: 'settings' } ]; itemsWithBadges: BottomNavigationItem[] = [ { id: 'home', label: 'Home', icon: 'home' }, { id: 'cart', label: 'Cart', icon: 'cart', badge: 2 }, { id: 'notifications', label: 'Alerts', icon: 'notifications', badge: '99+' }, { id: 'saved', label: 'Saved', icon: 'saved', badge: 15 }, { id: 'profile', label: 'Profile', icon: 'profile' } ]; itemsWithDisabled: BottomNavigationItem[] = [ { id: 'home', label: 'Home', icon: 'home' }, { id: 'search', label: 'Search', icon: 'search', disabled: true }, { id: 'profile', label: 'Profile', icon: 'profile' }, { id: 'settings', label: 'Settings', icon: 'settings' } ]; get interactiveItems(): BottomNavigationItem[] { return [ { id: 'home', label: 'Home', icon: 'home' }, { id: 'search', label: 'Search', icon: 'search' }, { id: 'favorites', label: 'Favorites', icon: 'favorites', badge: this.heartBadgeCount > 0 ? this.heartBadgeCount : undefined }, { id: 'profile', label: 'Profile', icon: 'profile' } ]; } handleActiveItemChange(context: string, itemId: string): void { this.activeItemIds[context] = itemId; } handleItemClick(item: BottomNavigationItem): void { console.log('Item clicked:', item); } handleInteractiveItemChange(itemId: string): void { this.interactiveActiveItemId = itemId; } handleInteractiveItemClick(item: BottomNavigationItem): void { this.clickCount++; this.lastClickedItem = item.label; console.log('Interactive item clicked:', item); } getActiveItemLabel(): string { const activeItem = this.interactiveItems.find(item => item.id === this.interactiveActiveItemId); return activeItem?.label || 'None'; } toggleHidden(): void { this.isHidden = !this.isHidden; // In a real implementation, you would update the hidden property of the navigation // For demo purposes, this just toggles a state variable } incrementBadge(): void { this.heartBadgeCount++; } }