Upload feature (c): atomic UI components (atoms/molecules/organisms) + stories
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { Component, input } from '@angular/core';
|
||||
|
||||
/** Atom: native progress bar for an in-flight upload. Pure UI — the caller supplies
|
||||
the percentage. */
|
||||
@Component({
|
||||
selector: 'app-upload-progress-bar',
|
||||
styles: [`
|
||||
:host { display: flex; align-items: center; gap: var(--rhc-space-max-md); }
|
||||
progress { flex: 1; height: var(--rhc-space-max-md); }
|
||||
.pct { font-size: var(--rhc-text-font-size-sm); color: var(--rhc-color-foreground-subtle); min-width: 3ch; text-align: end; }
|
||||
`],
|
||||
template: `
|
||||
<progress
|
||||
max="100"
|
||||
[value]="progressPct()"
|
||||
[attr.aria-label]="progressLabel"></progress>
|
||||
<span class="pct">{{ progressPct() }}%</span>
|
||||
`,
|
||||
})
|
||||
export class UploadProgressBarComponent {
|
||||
progressPct = input.required<number>();
|
||||
|
||||
protected readonly progressLabel = $localize`:@@upload.progress.label:Uploadvoortgang`;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { Meta, StoryObj } from '@storybook/angular';
|
||||
import { UploadProgressBarComponent } from './upload-progress-bar.component';
|
||||
|
||||
const meta: Meta<UploadProgressBarComponent> = {
|
||||
title: 'Atoms/UploadProgressBar',
|
||||
component: UploadProgressBarComponent,
|
||||
render: (args) => ({
|
||||
props: args,
|
||||
template: `<app-upload-progress-bar [progressPct]="progressPct" />`,
|
||||
}),
|
||||
};
|
||||
export default meta;
|
||||
type Story = StoryObj<UploadProgressBarComponent>;
|
||||
|
||||
export const Halfway: Story = { args: { progressPct: 45 } };
|
||||
export const Almost: Story = { args: { progressPct: 92 } };
|
||||
Reference in New Issue
Block a user