Overview
Shared components are highly reusable UI components located insrc/app/shared/. They provide consistent functionality across the entire application.
Generic List Component
hh-generic-list - A versatile, paginated data table component.
Location: src/app/shared/components/generic-list/generic-list.component.ts:1
Props
| Input | Type | Default | Description |
|---|---|---|---|
items | T[] | [] | Array of items to display |
columns | ColumnConfig[] | [] | Column configuration (auto-detect if empty) |
itemsPerPage | number | 10 | Items per page |
title | string? | - | Optional table title |
showActions | boolean | false | Show edit/delete buttons |
canEdit | (item: T) => boolean | - | Function to determine if item is editable |
canDelete | (item: T) => boolean | - | Function to determine if item is deletable |
Outputs
| Output | Type | Description |
|---|---|---|
rowClick | EventEmitter<T> | Emitted when a row is clicked |
pageChange | EventEmitter<number> | Emitted when page changes |
itemsPerPageChange | EventEmitter<number> | Emitted when items per page changes |
edit | EventEmitter<T> | Emitted when edit button is clicked |
delete | EventEmitter<T> | Emitted when delete button is clicked |
Usage Example
src/app/components/resident/registro-auto/registrar-auto.component.html:29
Features
- Auto-detection: Automatically detects columns from data if not specified
- Pagination: Built-in pagination with customizable page size
- Actions: Optional edit/delete buttons with conditional rendering
- Custom Formatters: Transform cell values with formatter functions
- HTML Support: Render HTML in cells when
isHtml: true - Responsive: Mobile-friendly responsive design
File Upload Component
hh-file-upload - Multi-file upload with drag-and-drop support and validation.
Location: src/app/shared/components/file-upload/file-upload.component.ts:1
Props
| Input | Type | Default | Description |
|---|---|---|---|
maxFiles | number | 10 | Maximum number of files |
allowedTypes | AllowedFileType[] | ['document'] | Allowed file types |
savePath | string | '' | Path where files will be saved (required) |
maxSizesByType | MaxSizesByType? | See defaults | Max file sizes by type |
componentId | string | 'file-upload' | Unique ID for multiple instances |
- Images: 5 MB
- Videos: 10 MB
- Documents: 5 MB
Outputs
| Output | Type | Description |
|---|---|---|
filesChange | output<File[]> | Emits array of valid selected files |
Public Methods
Usage Example
src/app/components/pagos-residente/pago-residente-form/pago-residente-form.component.html:94
Features
- Drag & Drop: Full drag-and-drop support
- Multiple Files: Support for multiple file uploads
- Type Validation: Validates file types (image/video/document)
- Size Validation: Per-type file size limits
- Error Handling: Clear error messages for validation failures
- Preview: Shows selected file names
- Dynamic Slots: Add/remove file input slots dynamically
Banner Carousel Component
hh-banner-carousel - Displays promotional banners with date filtering.
Location: src/app/shared/components/banner-carousel/banner-carousel.component.ts:1
Props
| Input | Type | Default | Description |
|---|---|---|---|
period | BannerPeriod | BannerPeriod.Month | Time period for banner filtering |
Usage Example
Features
- Date Filtering: Shows only active banners within selected period
- Smooth Scrolling: Carousel navigation with smooth scroll
- Responsive: Mobile-friendly horizontal scroll
- Loading State: Shows spinner while loading banners
- Error Handling: Gracefully handles loading errors
- UTC Dates: Proper timezone handling
Community Filter Component
hh-community-filter - Dropdown selector for filtering by community.
Location: src/app/shared/components/community-filter/community-filter.component.ts:1
Props
| Input | Type | Required | Description |
|---|---|---|---|
communities | CommunityFilterItem[] | Yes | List of communities |
selectedId | string | Yes | Currently selected ID |
showAllOption | boolean | No (false) | Show “All communities” option |
Outputs
| Output | Type | Description |
|---|---|---|
selectedIdChange | output<string> | Emits selected community ID or ‘all’ |
Usage Example
Top Menu Component
hh-top-menu - Horizontal navigation menu for sub-sections.
Location: src/app/shared/components/top-menu/top-menu.component.ts:1
Props
| Input | Type | Required | Description |
|---|---|---|---|
menuItems | TopMenuItem[] | Yes | Array of menu items |
Usage Example
Notification Component
hh-notification - Toast-style notification display.
Location: src/app/shared/components/notification/notification.component.ts:1
Props
| Input | Type | Required | Description |
|---|---|---|---|
notification | Notification | Yes | Notification object |
Usage with Service
Features
- Auto-dismiss: Configurable auto-dismiss duration
- Manual Dismiss: Close button
- Type Styling: Different colors/icons per notification type
- Icon Mapping: Automatic Font Awesome icon selection
- Container: Use with
hh-notification-containerfor stacking
Header Component
hh-header - Application header with branding and navigation.
Location: src/app/shared/header/header.component.ts:1
Properties
Usage
hh-nav-bar- Theme selector and top navigationhh-user-info- User profile information
Footer Component
hh-footer - Application footer.
Location: src/app/shared/footer/footer.component.ts:1
Usage
Left Menu Component
hh-left-menu - Main sidebar navigation menu.
Location: src/app/shared/left-menu/left-menu.component.ts:1
Features
- Role-based: Different menu items based on user role
- Active Route: Highlights current active route
- Computed Menu: Uses computed signal to filter menu based on route
- Panic Button: Emergency alert button for residents
Usage
src/app/shared/data/menu-options.data.ts
Nav Bar Component
hh-nav-bar - Top navigation bar with theme selector.
Location: src/app/shared/nav-bar/nav-bar.component.ts:1
Features
- Theme Switching: DaisyUI theme selector (6 themes)
- LocalStorage: Persists theme preference
- Signal-based: Reactive theme updates
Available Themes
Right Bar Component
hh-right-bar - Sidebar for notifications and announcements.
Location: src/app/shared/right-bar/right-bar.component.ts:1
Usage
hh-avisos-list- List of recent announcements/notices
Pagination Component
hh-pagination - Pagination controls (basic implementation).
Location: src/app/shared/pagination/pagination.component.ts:1
Props
| Input | Type | Required | Description |
|---|---|---|---|
totalPages | number | Yes | Total number of pages |
currentPage | number | Yes | Current active page |
Usage
hh-generic-list which has built-in pagination.
Breadcrumbs Component
hh-breadcrums - Breadcrumb navigation (basic implementation).
Location: src/app/shared/breadcrums/breadcrums.component.ts:1
Usage
Chart Components
Chart visualization components using Chart.js.Area Chart
Location:src/app/shared/charts/area-chart.component.ts:1
Bar Chart
Location:src/app/shared/charts/bar-chart.component.ts:1
Usage
Best Practices
Using Shared Components
-
Import as Standalone: All shared components are standalone
-
Type Safety: Always define interfaces for component data
-
Signal Inputs: Components use modern signal-based inputs
-
Event Handling: Use output signals for events
-
Responsive Design: Leverage Tailwind’s responsive utilities
Next Steps
- Layout Components - Page layout structures
- Component Architecture - Overall architecture
- Services - Service integration