# @workshack/ui Workshack UI component library for Angular applications with layout and navigation components. ## Installation ```bash npm install @workshack/ui ``` ## Components ### LayoutModule Import the complete layout module to get access to all layout components: ```typescript import { LayoutModule } from '@workshack/ui'; @Component({ imports: [LayoutModule], template: ` Action Button ` }) export class AppComponent {} ``` ### Layout Components #### LayoutComponent (``) **Selector:** `ui-layout` **Description:** Root container component that provides the main layout structure. **Usage:** ```html ``` **Properties:** None **Content Projection:** Accepts any content, typically `ui-menu` and `ui-content` --- #### MenuComponent (``) **Selector:** `ui-menu` **Description:** Vertical sidebar menu container for navigation items. **Usage:** ```html ``` **Properties:** None **Content Projection:** Accepts `ui-menu-item` components **Styling:** - Width: 4rem - Background: `var(--ui-color-menu-bg, #343a40)` - Color: `var(--ui-color-menu-text, #ffffff)` --- #### MenuItemComponent (``) **Selector:** `ui-menu-item` **Description:** Individual menu item with icon and label. **Usage:** ```html ``` **Properties:** - `label: string` (required) - Text label displayed below the icon - `icon: string` (required) - Icon name (uses RemixIcon classes) **Styling:** - Size: 4rem × 4rem - Hover effect: `rgba(255, 255, 255, 0.1)` background - Active state: `#2c2c2c` background - Icon size: 1.7rem - Label size: 0.6rem --- #### ContentComponent (``) **Selector:** `ui-content` **Description:** Main content area container. **Usage:** ```html ``` **Properties:** None **Content Projection:** Accepts any content, typically starts with `ui-header` --- #### HeaderComponent (``) **Selector:** `ui-header` **Description:** Page header with title and action buttons. **Usage:** ```html Add New Export ``` **Properties:** - `label: string` - Page title displayed in the header **Content Projection:** Right-aligned action buttons or other controls **Styling:** - Padding: 0.6rem - Background: `var(--ui-color-menu-bg, #343a40)` - Color: `var(--ui-color-menu-text, #ffffff)` - Title font size: 1.4rem - Title transform: capitalize --- ### IconComponent (Directive) **Selector:** `[uiIcon]` **Description:** Directive for displaying RemixIcon icons. **Usage:** ```html ``` **Properties:** - `uiIcon: string` - Icon name (RemixIcon class name without 'ri-' prefix) **Features:** - Automatically adds appropriate CSS classes - Injects SVG content for icons - Works with any HTML element ## CSS Variables The library uses CSS variables for theming. You can customize colors by defining these variables: ```css :root { --ui-color-menu-bg: #343a40; /* Menu background */ --ui-color-menu-text: #ffffff; /* Menu text color */ --ui-color-menu-hover: rgba(255, 255, 255, 0.1); /* Hover effect */ --ui-color-menu-active: #2c2c2c; /* Active item background */ --ui-color-icon-primary: #2c3e50; /* Icon color */ } ``` ## Complete Example ```typescript import { Component } from '@angular/core'; import { LayoutModule } from '@workshack/ui'; @Component({ selector: 'app-root', imports: [LayoutModule], template: ` Add New Export Welcome to Dashboard This is the main content area. `, styles: [` .content-body { padding: 1rem; } .btn { margin-left: 0.5rem; padding: 0.5rem 1rem; border: none; border-radius: 4px; cursor: pointer; } .btn-primary { background: #007bff; color: white; } .btn-secondary { background: #6c757d; color: white; } `] }) export class AppComponent { navigate(route: string) { console.log('Navigate to:', route); } addNew() { console.log('Add new item'); } export() { console.log('Export data'); } } ``` ### Card Components **Selectors:** `ui-card`, `ui-card-title`, `ui-card-menu`, `ui-card-footer` **Description:** Zestaw komponentów do tworzenia kart z opcjonalnym nagłówkiem, menu i stopką. **CardComponent (`ui-card`) Properties:** - `title?: string` - Tytuł karty wyświetlany w nagłówku - `margin: 0.5rem` - Domyślny margin karty - Kolory jak ui-menu (--ui-color-menu-bg, --ui-color-menu-text) **Standalone Components:** - `ui-card-title` - Tytuł karty z własnymi stylami - `ui-card-menu` - Menu/przyciski w nagłówku - `ui-card-footer` - Stopka karty z własnymi stylami **Usage:** ```html Zawartość karty Edytuj Usuń 123 Użytkownicy Ostatnia aktualizacja: dziś Raporty sprzedaży +12% ``` **CSS Variables:** - `--ui-color-card-bg` - tło karty - `--ui-color-card-border` - kolor obramowania - `--ui-color-card-title` - kolor tytułu - `--ui-color-card-text` - kolor tekstu - `--ui-color-card-footer-bg` - tło stopki - `--ui-shadow-card` - standardowy cień karty - `--ui-shadow-card-hover` - cień przy hover ## Development ### Building ```bash npm run build:ui ``` ### Watching for changes ```bash npm run watch:ui ``` ### Testing ```bash npm run test:ui ``` ### Publishing ```bash npm run publish:ui ``` ## License This library is licensed under a custom license that allows: - **Free use** for non-commercial applications (no revenue, no ads, no paid features) - **Commercial use** with attribution requirement - you must credit the library in your app (e.g., on an "About" or "For Developers" page) For full license terms, see the [LICENSE](LICENSE) file. ### Attribution Example for Commercial Use ``` This application uses Workshack UI Library (https://www.npmjs.com/package/@workshack/ui) © 2025 Workshack Team ```
This is the main content area.
Zawartość karty