refactor(ui): migrate controls to lucide (#1840)
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<header class="page-header flex flex-wrap items-center justify-between gap-3">
|
||||
<h1>Design System</h1>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<app-button variant="soft" size="sm" icon="pi pi-folder" label="Create library" (clicked)="openExample('library')" />
|
||||
<app-button variant="soft" size="sm" icon="pi pi-mobile" label="Device settings" (clicked)="openExample('device')" />
|
||||
<app-button variant="soft" size="sm" icon="pi pi-list" label="Everything" (clicked)="openExample('everything')" />
|
||||
<app-button variant="soft" size="sm" label="Create library" (clicked)="openExample('library')"><svg lucideFolder></svg></app-button>
|
||||
<app-button variant="soft" size="sm" label="Device settings" (clicked)="openExample('device')"><svg lucideSmartphone></svg></app-button>
|
||||
<app-button variant="soft" size="sm" label="Everything" (clicked)="openExample('everything')"><svg lucideList></svg></app-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
[tone]="example.tone"
|
||||
[variant]="example.variant"
|
||||
[size]="size"
|
||||
icon="pi pi-bolt"
|
||||
[label]="size" />
|
||||
[label]="size"><svg lucideZap></svg></app-button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,9 +29,9 @@
|
||||
</div>
|
||||
|
||||
<div class="sample-row">
|
||||
<app-button iconOnly icon="pi pi-chevron-left" ariaLabel="Previous" />
|
||||
<app-button iconOnly rounded icon="pi pi-heart" ariaLabel="Favourite" />
|
||||
<app-button label="Loading" icon="pi pi-save" loading />
|
||||
<app-button iconOnly ariaLabel="Previous"><svg lucideChevronLeft></svg></app-button>
|
||||
<app-button iconOnly rounded ariaLabel="Favourite"><svg lucideHeart></svg></app-button>
|
||||
<app-button label="Loading" loading><svg lucideSave></svg></app-button>
|
||||
<app-button label="Disabled" disabled />
|
||||
<app-button fluid label="Full width" />
|
||||
</div>
|
||||
@@ -45,18 +44,15 @@
|
||||
<app-split-button
|
||||
tone="primary"
|
||||
label="Open"
|
||||
icon="pi pi-folder-open"
|
||||
[model]="menuItems" />
|
||||
[model]="menuItems"><svg lucideFolderOpen></svg></app-split-button>
|
||||
<app-split-button
|
||||
label="Download"
|
||||
icon="pi pi-download"
|
||||
[model]="menuItems" />
|
||||
[model]="menuItems"><svg lucideDownload></svg></app-split-button>
|
||||
<app-split-button
|
||||
tone="danger"
|
||||
variant="soft"
|
||||
label="Delete"
|
||||
icon="pi pi-trash"
|
||||
[model]="menuItems" />
|
||||
[model]="menuItems"><svg lucideTrash2></svg></app-split-button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -90,20 +86,20 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<span>Trailing Action</span>
|
||||
<app-input value="Search text" trailingIcon="pi pi-times" trailingAriaLabel="Clear text" />
|
||||
<app-input value="Search text"><svg lucideX appInputTrailing></svg></app-input>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span>Leading Icon</span>
|
||||
<app-input type="search" leadingIcon="pi pi-search" placeholder="Search..." />
|
||||
<app-input type="search" placeholder="Search..."><svg lucideSearch appInputLeading></svg></app-input>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span>Leading + Trailing</span>
|
||||
<app-input
|
||||
type="search"
|
||||
value="Search text"
|
||||
leadingIcon="pi pi-search"
|
||||
trailingIcon="pi pi-times"
|
||||
trailingAriaLabel="Clear search" />
|
||||
value="Search text">
|
||||
<svg lucideSearch appInputLeading></svg>
|
||||
<svg lucideX appInputTrailing></svg>
|
||||
</app-input>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -481,7 +477,7 @@
|
||||
<app-accordion [items]="accordionItems" [(value)]="accordionValue">
|
||||
<ng-template appAccordionHeader let-item>{{ item.title }}</ng-template>
|
||||
<ng-template appAccordionActions>
|
||||
<app-button size="sm" variant="ghost" icon="pi pi-cog" iconOnly ariaLabel="Configure" />
|
||||
<app-button size="sm" variant="ghost" iconOnly ariaLabel="Configure"><svg lucideSettings></svg></app-button>
|
||||
</ng-template>
|
||||
<ng-template appAccordionContent let-item>{{ item.body }}</ng-template>
|
||||
</app-accordion>
|
||||
@@ -491,7 +487,7 @@
|
||||
<div class="max-w-md">
|
||||
<app-accordion multiple [items]="accordionItems" [(value)]="accordionMultiValue">
|
||||
<ng-template appAccordionHeader let-item>
|
||||
<span class="inline-flex items-center gap-2"><i class="pi pi-folder text-text-muted" aria-hidden="true"></i>{{ item.title }}</span>
|
||||
<span class="inline-flex items-center gap-2"><svg lucideFolder class="size-4 text-text-muted" aria-hidden="true"></svg>{{ item.title }}</span>
|
||||
</ng-template>
|
||||
<ng-template appAccordionContent let-item>{{ item.body }}</ng-template>
|
||||
</app-accordion>
|
||||
@@ -515,7 +511,7 @@
|
||||
<section class="showcase-section">
|
||||
<h2>Menus</h2>
|
||||
|
||||
<app-button label="Open menu" icon="pi pi-ellipsis-v" (clicked)="debugMenu.toggle($event)" />
|
||||
<app-button label="Open menu" (clicked)="debugMenu.toggle($event)"><svg lucideEllipsisVertical></svg></app-button>
|
||||
<app-menu #debugMenu [model]="menuItems" />
|
||||
</section>
|
||||
|
||||
@@ -550,7 +546,7 @@
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<app-tag size="sm" color="green" label="Small" />
|
||||
<app-tag size="md" color="green" label="Medium" />
|
||||
<app-tag color="amber" icon="pi pi-exclamation-triangle" label="With icon" />
|
||||
<app-tag color="amber" label="With icon"><svg lucideTriangleAlert></svg></app-tag>
|
||||
<app-tag color="sky">Projected content</app-tag>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,6 +3,25 @@ import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { Router } from '@angular/router';
|
||||
import { email, form, FormField, minLength, required, validate } from '@angular/forms/signals';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import {
|
||||
LucideChevronLeft,
|
||||
LucideDownload,
|
||||
LucideEllipsisVertical,
|
||||
LucideFile,
|
||||
LucideFolder,
|
||||
LucideFolderOpen,
|
||||
LucideHeart,
|
||||
LucideList,
|
||||
LucideSave,
|
||||
LucideSearch,
|
||||
LucideSettings,
|
||||
LucideSmartphone,
|
||||
LucideTag,
|
||||
LucideTrash2,
|
||||
LucideTriangleAlert,
|
||||
LucideX,
|
||||
LucideZap,
|
||||
} from '@lucide/angular';
|
||||
import { AppAccordionComponent } from '../../shared/ui/accordion/app-accordion.component';
|
||||
import {
|
||||
AppAccordionActionsDirective,
|
||||
@@ -76,6 +95,21 @@ interface ButtonExample {
|
||||
AppTagComponent,
|
||||
AppTextareaComponent,
|
||||
AppTooltipDirective,
|
||||
LucideFolder,
|
||||
LucideSmartphone,
|
||||
LucideList,
|
||||
LucideZap,
|
||||
LucideChevronLeft,
|
||||
LucideHeart,
|
||||
LucideSave,
|
||||
LucideSettings,
|
||||
LucideEllipsisVertical,
|
||||
LucideFolderOpen,
|
||||
LucideDownload,
|
||||
LucideTrash2,
|
||||
LucideSearch,
|
||||
LucideX,
|
||||
LucideTriangleAlert,
|
||||
FormField,
|
||||
],
|
||||
templateUrl: './design-system.component.html',
|
||||
@@ -137,9 +171,9 @@ export class DesignSystemComponent {
|
||||
];
|
||||
|
||||
readonly settingsTabs: TabItem[] = [
|
||||
{ id: 'general', label: 'General', icon: 'pi pi-cog' },
|
||||
{ id: 'metadata', label: 'Metadata', icon: 'pi pi-tag' },
|
||||
{ id: 'formats', label: 'Formats', icon: 'pi pi-file' },
|
||||
{ id: 'general', label: 'General', icon: LucideSettings.icon },
|
||||
{ id: 'metadata', label: 'Metadata', icon: LucideTag.icon },
|
||||
{ id: 'formats', label: 'Formats', icon: LucideFile.icon },
|
||||
];
|
||||
readonly manyTabs: TabItem[] = [
|
||||
{ id: 'general', label: 'General' },
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
<app-button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon="pi pi-chevron-left"
|
||||
label="Back to design system"
|
||||
styleClass="self-start"
|
||||
(clicked)="back()" />
|
||||
(clicked)="back()"><svg lucideChevronLeft></svg></app-button>
|
||||
<div class="flex flex-col gap-1">
|
||||
<h1 class="text-2xl font-extrabold text-text-strong">Device settings</h1>
|
||||
</div>
|
||||
@@ -18,7 +17,7 @@
|
||||
<app-tag [color]="deviceForm().dirty() ? 'amber' : 'neutral'" [label]="deviceForm().dirty() ? 'dirty' : 'pristine'" />
|
||||
<app-tag [color]="deviceForm().touched() ? 'sky' : 'neutral'" [label]="deviceForm().touched() ? 'touched' : 'untouched'" />
|
||||
@if (deviceForm().submitting()) {
|
||||
<app-tag color="primary" icon="pi pi-spin pi-spinner" label="submitting" />
|
||||
<app-tag color="primary" label="submitting"><svg lucideLoaderCircle class="animate-spin"></svg></app-tag>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -27,7 +26,7 @@
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<h2 class="m-0 inline-flex items-center gap-2 text-base font-bold text-text-strong">
|
||||
<i class="pi pi-book text-text-muted" aria-hidden="true"></i> Hardcover
|
||||
<svg lucideBook class="size-4 text-text-muted" aria-hidden="true"></svg> Hardcover
|
||||
</h2>
|
||||
<app-switch [formField]="deviceForm.hardcover.enabled" ariaLabel="Enable Hardcover sync" />
|
||||
</div>
|
||||
@@ -44,7 +43,7 @@
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<h2 class="m-0 inline-flex items-center gap-2 text-base font-bold text-text-strong">
|
||||
<i class="pi pi-tablet text-text-muted" aria-hidden="true"></i> Kobo
|
||||
<svg lucideTablet class="size-4 text-text-muted" aria-hidden="true"></svg> Kobo
|
||||
</h2>
|
||||
<app-switch [formField]="deviceForm.kobo.enabled" ariaLabel="Enable Kobo sync" />
|
||||
</div>
|
||||
@@ -77,7 +76,7 @@
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<h2 class="m-0 inline-flex items-center gap-2 text-base font-bold text-text-strong">
|
||||
<i class="pi pi-mobile text-text-muted" aria-hidden="true"></i> KOReader
|
||||
<svg lucideSmartphone class="size-4 text-text-muted" aria-hidden="true"></svg> KOReader
|
||||
</h2>
|
||||
<app-switch [formField]="deviceForm.koreader.enabled" ariaLabel="Enable KOReader sync" />
|
||||
</div>
|
||||
@@ -103,9 +102,8 @@
|
||||
type="submit"
|
||||
tone="primary"
|
||||
label="Save settings"
|
||||
icon="pi pi-save"
|
||||
[loading]="deviceForm().submitting()"
|
||||
[disabled]="deviceForm().submitting()" />
|
||||
[disabled]="deviceForm().submitting()"><svg lucideSave></svg></app-button>
|
||||
<app-button variant="soft" label="Validate" (clicked)="validateAll()" />
|
||||
<app-button variant="ghost" label="Reset" (clicked)="reset()" />
|
||||
@if (submitState() === 'saved') {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { AppNumberInputComponent } from '../../../shared/ui/number-input/app-num
|
||||
import { AppSliderComponent } from '../../../shared/ui/slider/app-slider.component';
|
||||
import { AppSwitchComponent } from '../../../shared/ui/switch/app-switch.component';
|
||||
import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component';
|
||||
import { LucideBook, LucideChevronLeft, LucideLoaderCircle, LucideSave, LucideSmartphone, LucideTablet } from '@lucide/angular';
|
||||
|
||||
interface DeviceFormModel {
|
||||
hardcover: { enabled: boolean; apiKey: string };
|
||||
@@ -57,6 +58,12 @@ function createInitialModel(): DeviceFormModel {
|
||||
AppSliderComponent,
|
||||
AppSwitchComponent,
|
||||
AppTagComponent,
|
||||
LucideBook,
|
||||
LucideSmartphone,
|
||||
LucideTablet,
|
||||
LucideChevronLeft,
|
||||
LucideSave,
|
||||
LucideLoaderCircle,
|
||||
],
|
||||
templateUrl: './device-form.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
<app-button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon="pi pi-chevron-left"
|
||||
label="Back to design system"
|
||||
styleClass="self-start"
|
||||
(clicked)="back()" />
|
||||
(clicked)="back()"><svg lucideChevronLeft></svg></app-button>
|
||||
<div class="flex flex-col gap-1">
|
||||
<h1 class="text-2xl font-extrabold text-text-strong">Everything</h1>
|
||||
</div>
|
||||
@@ -18,7 +17,7 @@
|
||||
<app-tag [color]="everythingForm().dirty() ? 'amber' : 'neutral'" [label]="everythingForm().dirty() ? 'dirty' : 'pristine'" />
|
||||
<app-tag [color]="everythingForm().touched() ? 'sky' : 'neutral'" [label]="everythingForm().touched() ? 'touched' : 'untouched'" />
|
||||
@if (everythingForm().submitting()) {
|
||||
<app-tag color="primary" icon="pi pi-spin pi-spinner" label="submitting" />
|
||||
<app-tag color="primary" label="submitting"><svg lucideLoaderCircle class="animate-spin"></svg></app-tag>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -95,9 +94,8 @@
|
||||
type="submit"
|
||||
tone="primary"
|
||||
label="Save"
|
||||
icon="pi pi-save"
|
||||
[loading]="everythingForm().submitting()"
|
||||
[disabled]="everythingForm().submitting()" />
|
||||
[disabled]="everythingForm().submitting()"><svg lucideSave></svg></app-button>
|
||||
<app-button variant="soft" label="Validate" (clicked)="validateAll()" />
|
||||
<app-button variant="ghost" label="Reset" (clicked)="reset()" />
|
||||
@if (submitState() === 'saved') {
|
||||
|
||||
@@ -22,6 +22,7 @@ import { AppDateRangePickerComponent, type DatePickerRange } from '../../../shar
|
||||
import { AppMessageComponent } from '../../../shared/ui/message/app-message.component';
|
||||
import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component';
|
||||
import { type SelectOption } from '../../../shared/ui/select/app-select.options';
|
||||
import { LucideChevronLeft, LucideLoaderCircle, LucideSave } from '@lucide/angular';
|
||||
|
||||
interface EverythingFormModel {
|
||||
text: string;
|
||||
@@ -86,6 +87,9 @@ function createInitialModel(): EverythingFormModel {
|
||||
AppDateRangePickerComponent,
|
||||
AppMessageComponent,
|
||||
AppTagComponent,
|
||||
LucideChevronLeft,
|
||||
LucideSave,
|
||||
LucideLoaderCircle,
|
||||
],
|
||||
templateUrl: './everything-form.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
<app-button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon="pi pi-chevron-left"
|
||||
label="Back to design system"
|
||||
styleClass="self-start"
|
||||
(clicked)="back()" />
|
||||
(clicked)="back()"><svg lucideChevronLeft></svg></app-button>
|
||||
<div class="flex flex-col gap-1">
|
||||
<h1 class="text-2xl font-extrabold text-text-strong">Create library</h1>
|
||||
</div>
|
||||
@@ -18,7 +17,7 @@
|
||||
<app-tag [color]="libraryForm().dirty() ? 'amber' : 'neutral'" [label]="libraryForm().dirty() ? 'dirty' : 'pristine'" />
|
||||
<app-tag [color]="libraryForm().touched() ? 'sky' : 'neutral'" [label]="libraryForm().touched() ? 'touched' : 'untouched'" />
|
||||
@if (libraryForm().submitting()) {
|
||||
<app-tag color="primary" icon="pi pi-spin pi-spinner" label="submitting" />
|
||||
<app-tag color="primary" label="submitting"><svg lucideLoaderCircle class="animate-spin"></svg></app-tag>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -63,9 +62,8 @@
|
||||
type="submit"
|
||||
tone="primary"
|
||||
label="Save library"
|
||||
icon="pi pi-save"
|
||||
[loading]="libraryForm().submitting()"
|
||||
[disabled]="libraryForm().submitting()" />
|
||||
[disabled]="libraryForm().submitting()"><svg lucideSave></svg></app-button>
|
||||
<app-button variant="soft" label="Validate" (clicked)="validateAll()" />
|
||||
<app-button variant="ghost" label="Reset" (clicked)="reset()" />
|
||||
@if (submitState() === 'saved') {
|
||||
|
||||
@@ -14,6 +14,7 @@ import { AppSelectComponent } from '../../../shared/ui/select/app-select.compone
|
||||
import { AppSwitchComponent } from '../../../shared/ui/switch/app-switch.component';
|
||||
import { AppTagComponent } from '../../../shared/ui/tag/app-tag.component';
|
||||
import { type SelectOption } from '../../../shared/ui/select/app-select.options';
|
||||
import { LucideChevronLeft, LucideLoaderCircle, LucideSave } from '@lucide/angular';
|
||||
|
||||
type OrganizationMode = 'BOOK_PER_FILE' | 'BOOK_PER_FOLDER';
|
||||
type MetadataSource = 'EMBEDDED' | 'SIDECAR' | 'PREFER_SIDECAR' | 'PREFER_EMBEDDED' | 'NONE';
|
||||
@@ -61,6 +62,9 @@ function createInitialModel(): LibraryFormModel {
|
||||
AppSelectComponent,
|
||||
AppSwitchComponent,
|
||||
AppTagComponent,
|
||||
LucideChevronLeft,
|
||||
LucideSave,
|
||||
LucideLoaderCircle,
|
||||
],
|
||||
templateUrl: './library-form.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
|
||||
Reference in New Issue
Block a user