mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
[SM-557] Use bitTypography for headers (#4839)
* Use bitTypography * Remove tw-text-xl from menu items
This commit is contained in:
parent
d67257218e
commit
4d38c7a92a
@ -23,10 +23,11 @@ import {
|
|||||||
LinkModule,
|
LinkModule,
|
||||||
MenuModule,
|
MenuModule,
|
||||||
MultiSelectModule,
|
MultiSelectModule,
|
||||||
|
RadioButtonModule,
|
||||||
TableModule,
|
TableModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
RadioButtonModule,
|
|
||||||
ToggleGroupModule,
|
ToggleGroupModule,
|
||||||
|
TypographyModule,
|
||||||
} from "@bitwarden/components";
|
} from "@bitwarden/components";
|
||||||
|
|
||||||
// Register the locales for the application
|
// Register the locales for the application
|
||||||
@ -67,10 +68,11 @@ import "./locales";
|
|||||||
LinkModule,
|
LinkModule,
|
||||||
MenuModule,
|
MenuModule,
|
||||||
MultiSelectModule,
|
MultiSelectModule,
|
||||||
|
RadioButtonModule,
|
||||||
TableModule,
|
TableModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
RadioButtonModule,
|
|
||||||
ToggleGroupModule,
|
ToggleGroupModule,
|
||||||
|
TypographyModule,
|
||||||
|
|
||||||
// Web specific
|
// Web specific
|
||||||
],
|
],
|
||||||
@ -100,10 +102,11 @@ import "./locales";
|
|||||||
LinkModule,
|
LinkModule,
|
||||||
MenuModule,
|
MenuModule,
|
||||||
MultiSelectModule,
|
MultiSelectModule,
|
||||||
|
RadioButtonModule,
|
||||||
TableModule,
|
TableModule,
|
||||||
TabsModule,
|
TabsModule,
|
||||||
RadioButtonModule,
|
|
||||||
ToggleGroupModule,
|
ToggleGroupModule,
|
||||||
|
TypographyModule,
|
||||||
|
|
||||||
// Web specific
|
// Web specific
|
||||||
],
|
],
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<div class="tw-mt-6 tw-flex tw-flex-col tw-gap-6">
|
<div class="tw-mt-6 tw-flex tw-flex-col tw-gap-6">
|
||||||
<sm-section>
|
<sm-section>
|
||||||
<h2 slot="summary" class="tw-mb-0 tw-text-2xl tw-font-semibold">{{ "projects" | i18n }}</h2>
|
<h2 slot="summary" class="tw-mb-0" bitTypography="h2" noMargin>{{ "projects" | i18n }}</h2>
|
||||||
<sm-projects-list
|
<sm-projects-list
|
||||||
(newProjectEvent)="openNewProjectDialog()"
|
(newProjectEvent)="openNewProjectDialog()"
|
||||||
(editProjectEvent)="openEditProject($event)"
|
(editProjectEvent)="openEditProject($event)"
|
||||||
@ -49,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</sm-section>
|
</sm-section>
|
||||||
<sm-section>
|
<sm-section>
|
||||||
<h2 slot="summary" class="tw-mb-0 tw-text-2xl tw-font-semibold">{{ "secrets" | i18n }}</h2>
|
<h2 slot="summary" class="tw-mb-0" bitTypography="h2" noMargin>{{ "secrets" | i18n }}</h2>
|
||||||
<sm-secrets-list
|
<sm-secrets-list
|
||||||
baseRoute="secrets"
|
baseRoute="secrets"
|
||||||
(deleteSecretsEvent)="openDeleteSecret($event)"
|
(deleteSecretsEvent)="openDeleteSecret($event)"
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td bitCell class="tw-w-0 tw-pr-0">
|
<td bitCell class="tw-w-0 tw-pr-0">
|
||||||
<i class="bwi bwi-wrench tw-text-xl tw-text-muted" aria-hidden="true"></i>
|
<i class="bwi bwi-wrench tw-text-muted" aria-hidden="true"></i>
|
||||||
</td>
|
</td>
|
||||||
<td bitCell class="tw-break-all">
|
<td bitCell class="tw-break-all">
|
||||||
<a bitLink [routerLink]="serviceAccount.id">
|
<a bitLink [routerLink]="serviceAccount.id">
|
||||||
@ -80,11 +80,11 @@
|
|||||||
</td>
|
</td>
|
||||||
<bit-menu #serviceAccountMenu>
|
<bit-menu #serviceAccountMenu>
|
||||||
<a type="button" bitMenuItem [routerLink]="serviceAccount.id">
|
<a type="button" bitMenuItem [routerLink]="serviceAccount.id">
|
||||||
<i class="bwi bwi-fw bwi-eye tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-eye" aria-hidden="true"></i>
|
||||||
{{ "viewServiceAccount" | i18n }}
|
{{ "viewServiceAccount" | i18n }}
|
||||||
</a>
|
</a>
|
||||||
<button type="button" bitMenuItem>
|
<button type="button" bitMenuItem>
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">
|
<span class="tw-text-danger">
|
||||||
{{ "deleteServiceAccount" | i18n }}
|
{{ "deleteServiceAccount" | i18n }}
|
||||||
</span>
|
</span>
|
||||||
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
<bit-menu #tableMenu>
|
<bit-menu #tableMenu>
|
||||||
<button type="button" bitMenuItem (click)="bulkDeleteServiceAccounts()">
|
<button type="button" bitMenuItem (click)="bulkDeleteServiceAccounts()">
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">
|
<span class="tw-text-danger">
|
||||||
{{ "deleteServiceAccounts" | i18n }}
|
{{ "deleteServiceAccounts" | i18n }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<ng-container *ngIf="rows?.length > 0; else empty">
|
<ng-container *ngIf="rows?.length > 0; else empty">
|
||||||
<tr bitRow *ngFor="let row of rows">
|
<tr bitRow *ngFor="let row of rows">
|
||||||
<td bitCell class="tw-w-0 tw-pr-0">
|
<td bitCell class="tw-w-0 tw-pr-0">
|
||||||
<i class="bwi {{ row.icon }} tw-text-xl tw-text-muted" aria-hidden="true"></i>
|
<i class="bwi {{ row.icon }} tw-text-muted" aria-hidden="true"></i>
|
||||||
</td>
|
</td>
|
||||||
<td bitCell>{{ row.name }}</td>
|
<td bitCell>{{ row.name }}</td>
|
||||||
<td bitCell *ngIf="row.type == 'serviceAccount'">
|
<td bitCell *ngIf="row.type == 'serviceAccount'">
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<h1
|
<h1
|
||||||
*ngIf="titleContainer.childElementCount === 0"
|
*ngIf="titleContainer.childElementCount === 0"
|
||||||
class="tw-m-0 tw-mr-2 tw-truncate tw-text-3xl tw-font-semibold tw-leading-10"
|
bitTypography="h1"
|
||||||
|
noMargin
|
||||||
|
class="tw-m-0 tw-mr-2 tw-truncate tw-leading-10"
|
||||||
[title]="title || (routeData.titleId | i18n)"
|
[title]="title || (routeData.titleId | i18n)"
|
||||||
>
|
>
|
||||||
<i *ngIf="icon" class="bwi {{ icon }}" aria-hidden="true"></i>
|
<i *ngIf="icon" class="bwi {{ icon }}" aria-hidden="true"></i>
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
|
|
||||||
<bit-menu #newMenu>
|
<bit-menu #newMenu>
|
||||||
<button type="button" bitMenuItem (click)="openProjectDialog()">
|
<button type="button" bitMenuItem (click)="openProjectDialog()">
|
||||||
<i class="bwi bwi-fw bwi-sitemap tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-sitemap" aria-hidden="true"></i>
|
||||||
{{ "project" | i18n }}
|
{{ "project" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="openSecretDialog()">
|
<button type="button" bitMenuItem (click)="openSecretDialog()">
|
||||||
<i class="bwi bwi-fw bwi-key tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-key" aria-hidden="true"></i>
|
||||||
{{ "secret" | i18n }}
|
{{ "secret" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="openServiceAccountDialog()">
|
<button type="button" bitMenuItem (click)="openServiceAccountDialog()">
|
||||||
<i class="bwi bwi-fw bwi-wrench tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-wrench" aria-hidden="true"></i>
|
||||||
{{ "serviceAccount" | i18n }}
|
{{ "serviceAccount" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td bitCell>
|
<td bitCell>
|
||||||
<div class="tw-flex tw-items-center tw-gap-4 tw-break-all">
|
<div class="tw-flex tw-items-center tw-gap-4 tw-break-all">
|
||||||
<i class="bwi bwi-collection tw-text-xl tw-text-muted" aria-hidden="true"></i>
|
<i class="bwi bwi-collection tw-text-muted" aria-hidden="true"></i>
|
||||||
<a bitLink [routerLink]="['/sm', project.organizationId, 'projects', project.id]">{{
|
<a bitLink [routerLink]="['/sm', project.organizationId, 'projects', project.id]">{{
|
||||||
project.name
|
project.name
|
||||||
}}</a>
|
}}</a>
|
||||||
@ -75,15 +75,15 @@
|
|||||||
</td>
|
</td>
|
||||||
<bit-menu #projectMenu>
|
<bit-menu #projectMenu>
|
||||||
<button type="button" bitMenuItem (click)="editProjectEvent.emit(project.id)">
|
<button type="button" bitMenuItem (click)="editProjectEvent.emit(project.id)">
|
||||||
<i class="bwi bwi-fw bwi-pencil tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-pencil" aria-hidden="true"></i>
|
||||||
{{ "editProject" | i18n }}
|
{{ "editProject" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<a bitMenuItem [routerLink]="['/sm', project.organizationId, 'projects', project.id]">
|
<a bitMenuItem [routerLink]="['/sm', project.organizationId, 'projects', project.id]">
|
||||||
<i class="bwi bwi-fw bwi-eye tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-eye" aria-hidden="true"></i>
|
||||||
{{ "viewProject" | i18n }}
|
{{ "viewProject" | i18n }}
|
||||||
</a>
|
</a>
|
||||||
<button type="button" bitMenuItem (click)="deleteProject(project.id)">
|
<button type="button" bitMenuItem (click)="deleteProject(project.id)">
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">{{ "deleteProject" | i18n }}</span>
|
<span class="tw-text-danger">{{ "deleteProject" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
<bit-menu #tableMenu>
|
<bit-menu #tableMenu>
|
||||||
<button type="button" bitMenuItem (click)="bulkDeleteProjects()">
|
<button type="button" bitMenuItem (click)="bulkDeleteProjects()">
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">{{ "deleteProjects" | i18n }}</span>
|
<span class="tw-text-danger">{{ "deleteProjects" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td bitCell>
|
<td bitCell>
|
||||||
<div class="tw-flex tw-items-center tw-gap-4 tw-break-all">
|
<div class="tw-flex tw-items-center tw-gap-4 tw-break-all">
|
||||||
<i class="bwi bwi-key tw-text-xl tw-text-muted" aria-hidden="true"></i>
|
<i class="bwi bwi-key tw-text-muted" aria-hidden="true"></i>
|
||||||
<button type="button" bitLink (click)="editSecretEvent.emit(secret.id)">
|
<button type="button" bitLink (click)="editSecretEvent.emit(secret.id)">
|
||||||
{{ secret.name }}
|
{{ secret.name }}
|
||||||
</button>
|
</button>
|
||||||
@ -94,15 +94,15 @@
|
|||||||
|
|
||||||
<bit-menu #secretMenu>
|
<bit-menu #secretMenu>
|
||||||
<button type="button" bitMenuItem (click)="editSecretEvent.emit(secret.id)" *ngIf="!trash">
|
<button type="button" bitMenuItem (click)="editSecretEvent.emit(secret.id)" *ngIf="!trash">
|
||||||
<i class="bwi bwi-fw bwi-pencil tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-pencil" aria-hidden="true"></i>
|
||||||
{{ "editSecret" | i18n }}
|
{{ "editSecret" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="copySecretNameEvent.emit(secret.id)">
|
<button type="button" bitMenuItem (click)="copySecretNameEvent.emit(secret.id)">
|
||||||
<i class="bwi bwi-fw bwi-clone tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
||||||
{{ "copySecretName" | i18n }}
|
{{ "copySecretName" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="copySecretValueEvent.emit(secret.id)">
|
<button type="button" bitMenuItem (click)="copySecretValueEvent.emit(secret.id)">
|
||||||
<i class="bwi bwi-fw bwi-clone tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-clone" aria-hidden="true"></i>
|
||||||
{{ "copySecretValue" | i18n }}
|
{{ "copySecretValue" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@ -111,11 +111,11 @@
|
|||||||
(click)="restoreSecretsEvent.emit([secret.id])"
|
(click)="restoreSecretsEvent.emit([secret.id])"
|
||||||
*ngIf="trash"
|
*ngIf="trash"
|
||||||
>
|
>
|
||||||
<i class="bwi bwi-fw bwi-refresh tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-refresh" aria-hidden="true"></i>
|
||||||
{{ "restoreSecret" | i18n }}
|
{{ "restoreSecret" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="deleteSecretsEvent.emit([secret.id])">
|
<button type="button" bitMenuItem (click)="deleteSecretsEvent.emit([secret.id])">
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">{{ "deleteSecret" | i18n }}</span>
|
<span class="tw-text-danger">{{ "deleteSecret" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
@ -125,11 +125,11 @@
|
|||||||
|
|
||||||
<bit-menu #tableMenu>
|
<bit-menu #tableMenu>
|
||||||
<button type="button" bitMenuItem (click)="bulkRestoreSecrets()" *ngIf="trash">
|
<button type="button" bitMenuItem (click)="bulkRestoreSecrets()" *ngIf="trash">
|
||||||
<i class="bwi bwi-fw bwi-refresh tw-text-xl" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-refresh" aria-hidden="true"></i>
|
||||||
<span>{{ "restoreSelected" | i18n }}</span>
|
<span>{{ "restoreSelected" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" bitMenuItem (click)="bulkDeleteSecrets()">
|
<button type="button" bitMenuItem (click)="bulkDeleteSecrets()">
|
||||||
<i class="bwi bwi-fw bwi-trash tw-text-xl tw-text-danger" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-trash tw-text-danger" aria-hidden="true"></i>
|
||||||
<span class="tw-text-danger">{{ "deleteSecrets" | i18n }}</span>
|
<span class="tw-text-danger">{{ "deleteSecrets" | i18n }}</span>
|
||||||
</button>
|
</button>
|
||||||
</bit-menu>
|
</bit-menu>
|
||||||
|
@ -1,26 +1,45 @@
|
|||||||
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
||||||
import { Directive, HostBinding, Input } from "@angular/core";
|
import { Directive, HostBinding, Input } from "@angular/core";
|
||||||
|
|
||||||
type TypographyType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "helper";
|
type TypographyType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "helper";
|
||||||
|
|
||||||
const styles: Record<TypographyType, string[]> = {
|
const styles: Record<TypographyType, string[]> = {
|
||||||
h1: ["tw-text-3xl", "tw-font-semibold", "tw-mb-2"],
|
h1: ["tw-text-3xl", "tw-font-semibold"],
|
||||||
h2: ["tw-text-2xl", "tw-font-semibold", "tw-mb-2"],
|
h2: ["tw-text-2xl", "tw-font-semibold"],
|
||||||
h3: ["tw-text-xl", "tw-font-semibold", "tw-mb-2"],
|
h3: ["tw-text-xl", "tw-font-semibold"],
|
||||||
h4: ["tw-text-lg", "tw-font-semibold", "tw-mb-2"],
|
h4: ["tw-text-lg", "tw-font-semibold"],
|
||||||
h5: ["tw-text-base", "tw-font-semibold", "tw-mb-2"],
|
h5: ["tw-text-base", "tw-font-semibold"],
|
||||||
h6: ["tw-text-sm", "tw-font-semibold", "tw-mb-2"],
|
h6: ["tw-text-sm", "tw-font-semibold"],
|
||||||
body1: ["tw-text-base"],
|
body1: ["tw-text-base"],
|
||||||
body2: ["tw-text-sm"],
|
body2: ["tw-text-sm"],
|
||||||
helper: ["tw-text-xs"],
|
helper: ["tw-text-xs"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const margins: Record<TypographyType, string[]> = {
|
||||||
|
h1: ["tw-mb-2"],
|
||||||
|
h2: ["tw-mb-2"],
|
||||||
|
h3: ["tw-mb-2"],
|
||||||
|
h4: ["tw-mb-2"],
|
||||||
|
h5: ["tw-mb-2"],
|
||||||
|
h6: ["tw-mb-2"],
|
||||||
|
body1: [],
|
||||||
|
body2: [],
|
||||||
|
helper: [],
|
||||||
|
};
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: "[bitTypography]",
|
selector: "[bitTypography]",
|
||||||
})
|
})
|
||||||
export class TypographyDirective {
|
export class TypographyDirective {
|
||||||
@Input("bitTypography") bitTypography: TypographyType;
|
@Input("bitTypography") bitTypography: TypographyType;
|
||||||
|
|
||||||
|
private _margin = true;
|
||||||
|
@Input()
|
||||||
|
set noMargin(value: boolean | "") {
|
||||||
|
this._margin = !coerceBooleanProperty(value);
|
||||||
|
}
|
||||||
|
|
||||||
@HostBinding("class") get classList() {
|
@HostBinding("class") get classList() {
|
||||||
return styles[this.bitTypography];
|
return styles[this.bitTypography].concat(this._margin ? margins[this.bitTypography] : []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user