[SM-660] move sm-no-items to CL (#5059)
* refactor: move sm-no-items to CL * update and run prettier * apply code review
This commit is contained in:
parent
2ad739b5a8
commit
36de1c8e32
|
@ -2,7 +2,7 @@
|
||||||
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<sm-no-items *ngIf="tokens?.length == 0">
|
<bit-no-items *ngIf="tokens?.length == 0">
|
||||||
<ng-container slot="title">{{ "accessTokensNoItemsTitle" | i18n }}</ng-container>
|
<ng-container slot="title">{{ "accessTokensNoItemsTitle" | i18n }}</ng-container>
|
||||||
<ng-container slot="description">{{ "accessTokensNoItemsDesc" | i18n }}</ng-container>
|
<ng-container slot="description">{{ "accessTokensNoItemsDesc" | i18n }}</ng-container>
|
||||||
<button
|
<button
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
||||||
{{ "newAccessToken" | i18n }}
|
{{ "newAccessToken" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
</sm-no-items>
|
</bit-no-items>
|
||||||
|
|
||||||
<bit-table *ngIf="tokens?.length >= 1">
|
<bit-table *ngIf="tokens?.length >= 1">
|
||||||
<ng-container header>
|
<ng-container header>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<sm-no-items *ngIf="serviceAccounts?.length == 0">
|
<bit-no-items *ngIf="serviceAccounts?.length == 0">
|
||||||
<ng-container slot="title">{{ "serviceAccountsNoItemsTitle" | i18n }}</ng-container>
|
<ng-container slot="title">{{ "serviceAccountsNoItemsTitle" | i18n }}</ng-container>
|
||||||
<ng-container slot="description">{{ "serviceAccountsNoItemsMessage" | i18n }}</ng-container>
|
<ng-container slot="description">{{ "serviceAccountsNoItemsMessage" | i18n }}</ng-container>
|
||||||
<button
|
<button
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
||||||
{{ "newServiceAccount" | i18n }}
|
{{ "newServiceAccount" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
</sm-no-items>
|
</bit-no-items>
|
||||||
|
|
||||||
<bit-table *ngIf="serviceAccounts?.length >= 1" [dataSource]="dataSource">
|
<bit-table *ngIf="serviceAccounts?.length >= 1" [dataSource]="dataSource">
|
||||||
<ng-container header>
|
<ng-container header>
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { Component } from "@angular/core";
|
|
||||||
|
|
||||||
import { Icons } from "@bitwarden/components";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: "sm-no-items",
|
|
||||||
templateUrl: "./no-items.component.html",
|
|
||||||
})
|
|
||||||
export class NoItemsComponent {
|
|
||||||
protected icon = Icons.Search;
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<sm-no-items *ngIf="projects?.length == 0">
|
<bit-no-items *ngIf="projects?.length == 0">
|
||||||
<ng-container slot="title">{{ "projectsNoItemsTitle" | i18n }}</ng-container>
|
<ng-container slot="title">{{ "projectsNoItemsTitle" | i18n }}</ng-container>
|
||||||
<ng-container slot="description">{{ "projectsNoItemsMessage" | i18n }}</ng-container>
|
<ng-container slot="description">{{ "projectsNoItemsMessage" | i18n }}</ng-container>
|
||||||
<button
|
<button
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
||||||
{{ "newProject" | i18n }}
|
{{ "newProject" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
</sm-no-items>
|
</bit-no-items>
|
||||||
|
|
||||||
<bit-table *ngIf="projects?.length >= 1" [dataSource]="dataSource">
|
<bit-table *ngIf="projects?.length >= 1" [dataSource]="dataSource">
|
||||||
<ng-container header>
|
<ng-container header>
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-container *ngIf="secrets?.length == 0">
|
<ng-container *ngIf="secrets?.length == 0">
|
||||||
<sm-no-items *ngIf="trash">
|
<bit-no-items *ngIf="trash">
|
||||||
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
|
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
|
||||||
<ng-container slot="description">{{ "secretsTrashNoItemsMessage" | i18n }}</ng-container>
|
<ng-container slot="description">{{ "secretsTrashNoItemsMessage" | i18n }}</ng-container>
|
||||||
</sm-no-items>
|
</bit-no-items>
|
||||||
<sm-no-items *ngIf="!trash">
|
<bit-no-items *ngIf="!trash">
|
||||||
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
|
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
|
||||||
<ng-container slot="description">{{ "secretsNoItemsMessage" | i18n }}</ng-container>
|
<ng-container slot="description">{{ "secretsNoItemsMessage" | i18n }}</ng-container>
|
||||||
<button
|
<button
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
||||||
{{ "newSecret" | i18n }}
|
{{ "newSecret" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
</sm-no-items>
|
</bit-no-items>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<bit-table *ngIf="secrets?.length >= 1" [dataSource]="dataSource">
|
<bit-table *ngIf="secrets?.length >= 1" [dataSource]="dataSource">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
|
|
||||||
import { MultiSelectModule } from "@bitwarden/components";
|
import { MultiSelectModule, NoItemsModule } from "@bitwarden/components";
|
||||||
import { CoreOrganizationModule } from "@bitwarden/web-vault/app/admin-console/organizations/core";
|
import { CoreOrganizationModule } from "@bitwarden/web-vault/app/admin-console/organizations/core";
|
||||||
import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module";
|
import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module";
|
||||||
import { SharedModule } from "@bitwarden/web-vault/app/shared";
|
import { SharedModule } from "@bitwarden/web-vault/app/shared";
|
||||||
|
@ -10,19 +10,24 @@ import { AccessRemovalDialogComponent } from "./access-policies/dialogs/access-r
|
||||||
import { BulkStatusDialogComponent } from "./dialogs/bulk-status-dialog.component";
|
import { BulkStatusDialogComponent } from "./dialogs/bulk-status-dialog.component";
|
||||||
import { HeaderComponent } from "./header.component";
|
import { HeaderComponent } from "./header.component";
|
||||||
import { NewMenuComponent } from "./new-menu.component";
|
import { NewMenuComponent } from "./new-menu.component";
|
||||||
import { NoItemsComponent } from "./no-items.component";
|
|
||||||
import { ProjectsListComponent } from "./projects-list.component";
|
import { ProjectsListComponent } from "./projects-list.component";
|
||||||
import { SecretsListComponent } from "./secrets-list.component";
|
import { SecretsListComponent } from "./secrets-list.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, ProductSwitcherModule, MultiSelectModule, CoreOrganizationModule],
|
imports: [
|
||||||
|
SharedModule,
|
||||||
|
ProductSwitcherModule,
|
||||||
|
MultiSelectModule,
|
||||||
|
CoreOrganizationModule,
|
||||||
|
NoItemsModule,
|
||||||
|
],
|
||||||
exports: [
|
exports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
NoItemsModule,
|
||||||
AccessRemovalDialogComponent,
|
AccessRemovalDialogComponent,
|
||||||
BulkStatusDialogComponent,
|
BulkStatusDialogComponent,
|
||||||
HeaderComponent,
|
HeaderComponent,
|
||||||
NewMenuComponent,
|
NewMenuComponent,
|
||||||
NoItemsComponent,
|
|
||||||
ProjectsListComponent,
|
ProjectsListComponent,
|
||||||
SecretsListComponent,
|
SecretsListComponent,
|
||||||
AccessSelectorComponent,
|
AccessSelectorComponent,
|
||||||
|
@ -32,7 +37,6 @@ import { SecretsListComponent } from "./secrets-list.component";
|
||||||
BulkStatusDialogComponent,
|
BulkStatusDialogComponent,
|
||||||
HeaderComponent,
|
HeaderComponent,
|
||||||
NewMenuComponent,
|
NewMenuComponent,
|
||||||
NoItemsComponent,
|
|
||||||
ProjectsListComponent,
|
ProjectsListComponent,
|
||||||
SecretsListComponent,
|
SecretsListComponent,
|
||||||
AccessSelectorComponent,
|
AccessSelectorComponent,
|
||||||
|
|
|
@ -16,6 +16,7 @@ export * from "./link";
|
||||||
export * from "./menu";
|
export * from "./menu";
|
||||||
export * from "./multi-select";
|
export * from "./multi-select";
|
||||||
export * from "./navigation";
|
export * from "./navigation";
|
||||||
|
export * from "./no-items";
|
||||||
export * from "./progress";
|
export * from "./progress";
|
||||||
export * from "./radio-button";
|
export * from "./radio-button";
|
||||||
export * from "./table";
|
export * from "./table";
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "./no-items.module";
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
|
import { Icons } from "..";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component for displaying a message when there are no items to display. Expects title, description and button slots.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: "bit-no-items",
|
||||||
|
templateUrl: "./no-items.component.html",
|
||||||
|
})
|
||||||
|
export class NoItemsComponent {
|
||||||
|
protected icon = Icons.Search;
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { CommonModule } from "@angular/common";
|
||||||
|
import { NgModule } from "@angular/core";
|
||||||
|
|
||||||
|
import { IconModule } from "../icon";
|
||||||
|
|
||||||
|
import { NoItemsComponent } from "./no-items.component";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [CommonModule, IconModule],
|
||||||
|
exports: [NoItemsComponent],
|
||||||
|
declarations: [NoItemsComponent],
|
||||||
|
})
|
||||||
|
export class NoItemsModule {}
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { Meta, moduleMetadata, Story } from "@storybook/angular";
|
||||||
|
|
||||||
|
import { ButtonModule } from "../button";
|
||||||
|
|
||||||
|
import { NoItemsModule } from "./no-items.module";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: "Component Library/No Items",
|
||||||
|
decorators: [
|
||||||
|
moduleMetadata({
|
||||||
|
imports: [ButtonModule, NoItemsModule],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
} as Meta;
|
||||||
|
|
||||||
|
const Template: Story = (args) => ({
|
||||||
|
props: args,
|
||||||
|
template: `
|
||||||
|
<bit-no-items class="tw-text-main">
|
||||||
|
<ng-container slot="title">No items found</ng-container>
|
||||||
|
<ng-container slot="description">Your description here.</ng-container>
|
||||||
|
<button
|
||||||
|
slot="button"
|
||||||
|
type="button"
|
||||||
|
bitButton
|
||||||
|
buttonType="secondary"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-plus" aria-hidden="true"></i>
|
||||||
|
New item
|
||||||
|
</button>
|
||||||
|
</bit-no-items>
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Default = Template.bind({});
|
Loading…
Reference in New Issue