Skip to content

Commit

Permalink
feat: add status storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
rfrt committed Aug 14, 2024
1 parent a564e46 commit 173d398
Show file tree
Hide file tree
Showing 11 changed files with 676 additions and 25 deletions.
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"compodoc": true,
"compodocArgs": ["-e", "json", "-d", "projects/storybook"],
"port": 6006,
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "@fontsource/roboto/300.css", "@fontsource/roboto/400.css", "@fontsource/roboto/500.css", "@fontsource/roboto/700.css", "@fontsource/material-icons", "./projects/storybook/src/stories/layout/layout.scss", "./projects/storybook/src/stories/user-card/user-card.scss", "./projects/storybook/src/stories/list-loader/list-loader.scss", "./projects/storybook/src/stories/search-container/search-container.scss"]
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "@fontsource/roboto/300.css", "@fontsource/roboto/400.css", "@fontsource/roboto/500.css", "@fontsource/roboto/700.css", "@fontsource/material-icons", "./projects/storybook/src/stories/layout/layout.scss", "./projects/storybook/src/stories/user-card/user-card.scss", "./projects/storybook/src/stories/list-loader/list-loader.scss", "./projects/storybook/src/stories/search-container/search-container.scss", "./projects/storybook/src/stories/status/status.scss"]
}
},
"build-storybook": {
Expand All @@ -141,7 +141,7 @@
"compodoc": true,
"compodocArgs": ["-e", "json", "-d", "projects/storybook"],
"outputDir": "dist/storybook/storybook",
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "@fontsource/roboto/300.css", "@fontsource/roboto/400.css", "@fontsource/roboto/500.css", "@fontsource/roboto/700.css", "@fontsource/material-icons", "./projects/storybook/src/stories/layout/layout.scss", "./projects/storybook/src/stories/user-card/user-card.scss", "./projects/storybook/src/stories/list-loader/list-loader.scss", "./projects/storybook/src/stories/search-container/search-container.scss"]
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "@fontsource/roboto/300.css", "@fontsource/roboto/400.css", "@fontsource/roboto/500.css", "@fontsource/roboto/700.css", "@fontsource/material-icons", "./projects/storybook/src/stories/layout/layout.scss", "./projects/storybook/src/stories/user-card/user-card.scss", "./projects/storybook/src/stories/list-loader/list-loader.scss", "./projects/storybook/src/stories/search-container/search-container.scss", "./projects/storybook/src/stories/status/status.scss"]
}
}
}
Expand Down
1 change: 1 addition & 0 deletions projects/message-box/src/message-box.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ngx-message-box {
font-family: 'Roboto';
display: block;
overflow: hidden;
border-radius: 3px;
Expand Down
1 change: 1 addition & 0 deletions projects/status/src/status.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ngx-status {
}

> span {
width: calc(100% - 24px);
b {
display: block;
font-size: 12px;
Expand Down
223 changes: 212 additions & 11 deletions projects/storybook/documentation.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<div class="layout-wrapper">
<ngx-layout [toolbarColor]="toolbarColor" [withBackButton]="withBackButton" backButtonLabel="Back button label" [withCloseButton]="withCloseButton" (backButtonClicked)="log('Back button clicked', $event)" (closeButtonClicked)="log('Close button clicked', $event)" (sideFilterOpened)="log('Side filter opened')" (sideFilterClosed)="log('Side filter closed')">
<ng-template #layoutToolbar>
<span toolbar-title>Accès dossier patient</span>
<ngx-search-container>
<input type="text" [(ngModel)]="search" (ngModelChange)="log('Search changed', $event)" placeholder="Search" autocomplete="off" ngx-search-input />
</ngx-search-container>

<button type="button" mat-icon-button matTooltip="Help" (click)="log('Help button clicked', $event)">
<mat-icon>help_outline</mat-icon>
</button>
</ng-template>

<!-- Primary action -->
<ng-template #layoutPrimaryAction>
<button type="button" mat-fab matTooltip="Add" (click)="log('Add button clicked', $event)">
<mat-icon>add</mat-icon>
</button>
</ng-template>

<!-- Actions panel -->
<ng-template #layoutActions>
<button type="button" mat-icon-button matTooltip="Refresh" (click)="log('Refresh button clicked', $event)">
<mat-icon>refresh</mat-icon>
</button>

<button type="button" mat-icon-button matTooltip="Favorite" (click)="log('Favorite button clicked', $event)">
<mat-icon>favorite</mat-icon>
</button>
</ng-template>

<!-- Right panel -->
<ng-template #layoutRight>
<div class="layout-right-container">
Layout right
<div filters-chip-list>
<mat-chip-listbox class="mat-mdc-chip-set-stacked" aria-label="Color selection">
<mat-chip-option (click)="log('Chip 1 clicked', $event)">1</mat-chip-option>
<mat-chip-option (click)="log('Chip 2 clicked', $event)">2</mat-chip-option>
<mat-chip-option (click)="log('Chip 3 clicked', $event)">3</mat-chip-option>
</mat-chip-listbox>
</div>
</div>
</ng-template>

<!-- Info boxes panel -->
<ng-template #layoutInfoBoxes>
<span class="info-box">Info box</span>
<span class="info-box primary">Info box primary</span>
<span class="info-box accent">Info box accent</span>
</ng-template>

<div class="content-container">Layout content</div>
</ngx-layout>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.layout-wrapper {
height: 300px;
position: relative;
}
51 changes: 51 additions & 0 deletions projects/storybook/src/stories/status/layout-wrapper.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject, Input, ViewEncapsulation } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatChipsModule } from '@angular/material/chips';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';

import { NgxLayoutComponent } from '../../../../layout/src/layout.component';
import { NgxSearchContainerComponent, NgxSearchInputDirective } from '../../../../search-container/src/search-container.component';
import { NgxStatusService } from '../../../../status/src/status.service';

@Component({
selector: 'storybook-layout-wrapper',
templateUrl: './layout-wrapper.component.html',
styleUrls: ['./layout-wrapper.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [
CommonModule,
FormsModule,
MatButtonModule,
MatIconModule,
MatTooltipModule,
MatChipsModule,
NgxSearchContainerComponent,
NgxSearchInputDirective,
NgxLayoutComponent
]
})
export class StorybookLayoutWrapperComponent {

@Input()
public toolbarColor = 'primary';

protected withBackButton = true;
protected withCloseButton = true;
protected search: string | undefined;

private ngxStatusService = inject(NgxStatusService);

protected log(msg: string, event?: Event): void {
console.log(msg, event);
this.ngxStatusService.showStatus({
title: msg,
type: 'info',
duration: 1000
});
}
}
29 changes: 29 additions & 0 deletions projects/storybook/src/stories/status/status.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@use '../../../../core/src/styles/themeVariables' as themeVariables;
@use '../../../../core/src/styles/theme';
@use '../../../../status/src/status-theme' as statusTheme;
@use '../../../../message-box/src/message-box-theme' as messageBoxTheme;

@include statusTheme.theme(themeVariables.$theme);
@include messageBoxTheme.theme(themeVariables.$theme);

section {
padding: 5rem;
font-family: 'Roboto';
background-color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

ngx-snackbar {
position: relative !important;
}
.matButtonContainer {
display: flex;
justify-content: center;
}
}
.maCustomClassCss {
background-color: burlywood !important;
font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif !important;
}
Loading

0 comments on commit 173d398

Please sign in to comment.