From 30814423ae98b6ac5f7407fc53cffe32aae57124 Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Fri, 31 Jul 2020 11:30:57 +0200 Subject: Improve (accessibility title) and move action-buttons on left in tables (#2980) * Improve and move action-buttons on left in tables * Focus on my-delete and my-button * Correct spaces syntax * Move user-action dropdown on the left Co-authored-by: kimsible --- .../shared-main/buttons/button.component.html | 4 ++-- .../shared-main/buttons/button.component.scss | 4 ++++ .../buttons/delete-button.component.html | 3 +-- .../shared-main/buttons/delete-button.component.ts | 17 ++++++++++++--- .../shared-main/buttons/edit-button.component.html | 3 +-- .../shared-main/buttons/edit-button.component.ts | 24 ++++++++++++++++++++-- .../account-blocklist.component.html | 8 ++++---- .../server-blocklist.component.html | 8 ++++---- .../user-moderation-dropdown.component.ts | 2 +- 9 files changed, 53 insertions(+), 20 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-main/buttons/button.component.html b/client/src/app/shared/shared-main/buttons/button.component.html index 8eccd5c3c..65e06f7a4 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.html +++ b/client/src/app/shared/shared-main/buttons/button.component.html @@ -1,8 +1,8 @@ - + - {{ label }} + {{ label }} diff --git a/client/src/app/shared/shared-main/buttons/button.component.scss b/client/src/app/shared/shared-main/buttons/button.component.scss index 06fde9f1d..f73b7b808 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.scss +++ b/client/src/app/shared/shared-main/buttons/button.component.scss @@ -1,6 +1,10 @@ @import '_variables'; @import '_mixins'; +:host { + outline: none; +} + my-small-loader ::ng-deep .root { display: inline-block; margin: 0 3px 0 0; diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.html b/client/src/app/shared/shared-main/buttons/delete-button.component.html index 6643e6013..c94d8d0c9 100644 --- a/client/src/app/shared/shared-main/buttons/delete-button.component.html +++ b/client/src/app/shared/shared-main/buttons/delete-button.component.html @@ -1,6 +1,5 @@ - + {{ label }} - Delete diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.ts b/client/src/app/shared/shared-main/buttons/delete-button.component.ts index 39e31900f..aced0f881 100644 --- a/client/src/app/shared/shared-main/buttons/delete-button.component.ts +++ b/client/src/app/shared/shared-main/buttons/delete-button.component.ts @@ -9,12 +9,23 @@ import { I18n } from '@ngx-translate/i18n-polyfill' export class DeleteButtonComponent implements OnInit { @Input() label: string - - title: string + @Input() title: string constructor (private i18n: I18n) { } ngOnInit () { - this.title = this.label || this.i18n('Delete') + // No label + if (this.label === undefined && !this.title) { + this.title = this.i18n('Delete') + } + + // Use default label + if (this.label === '') { + this.label = this.i18n('Delete') + + if (!this.title) { + this.title = this.label + } + } } } diff --git a/client/src/app/shared/shared-main/buttons/edit-button.component.html b/client/src/app/shared/shared-main/buttons/edit-button.component.html index 4ffc563d9..ecb709be1 100644 --- a/client/src/app/shared/shared-main/buttons/edit-button.component.html +++ b/client/src/app/shared/shared-main/buttons/edit-button.component.html @@ -1,6 +1,5 @@ - + {{ label }} - Update diff --git a/client/src/app/shared/shared-main/buttons/edit-button.component.ts b/client/src/app/shared/shared-main/buttons/edit-button.component.ts index 9cfe1a3bb..d8ae39b84 100644 --- a/client/src/app/shared/shared-main/buttons/edit-button.component.ts +++ b/client/src/app/shared/shared-main/buttons/edit-button.component.ts @@ -1,4 +1,5 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, OnInit } from '@angular/core' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-edit-button', @@ -6,7 +7,26 @@ import { Component, Input } from '@angular/core' templateUrl: './edit-button.component.html' }) -export class EditButtonComponent { +export class EditButtonComponent implements OnInit { @Input() label: string + @Input() title: string @Input() routerLink: string[] | string = [] + + constructor (private i18n: I18n) { } + + ngOnInit () { + // No label + if (this.label === undefined && !this.title) { + this.title = this.i18n('Update') + } + + // Use default label + if (this.label === '') { + this.label = this.i18n('Update') + + if (!this.title) { + this.title = this.label + } + } + } } diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.html b/client/src/app/shared/shared-moderation/account-blocklist.component.html index df98cf84e..5af1095f1 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.html +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.html @@ -24,14 +24,17 @@ + Action Account Muted at - + + +
@@ -50,9 +53,6 @@ {{ accountBlock.createdAt | date: 'short' }} - - - diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.html b/client/src/app/shared/shared-moderation/server-blocklist.component.html index 4621414d9..598e1a42c 100644 --- a/client/src/app/shared/shared-moderation/server-blocklist.component.html +++ b/client/src/app/shared/shared-moderation/server-blocklist.component.html @@ -28,14 +28,17 @@ + Action Instance Muted at - + + + {{ serverBlock.blockedServer.host }} @@ -43,9 +46,6 @@ {{ serverBlock.createdAt | date: 'short' }} - - - diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts index 78c2658df..34fa7366c 100644 --- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts @@ -19,7 +19,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges { @Input() prependActions: DropdownAction<{ user: User, account: Account }>[] @Input() buttonSize: 'normal' | 'small' = 'normal' - @Input() placement = 'left-top left-bottom auto' + @Input() placement = 'right-top right-bottom auto' @Input() label: string @Input() container: 'body' | undefined = undefined -- cgit v1.2.3