From eacb25c4366bcc8fba20f98f93f004fabc6d5578 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Aug 2018 17:36:10 +0200 Subject: Add reason when banning a user --- .../shared/buttons/action-dropdown.component.html | 16 ++++++++ .../shared/buttons/action-dropdown.component.scss | 21 +++++++++++ .../shared/buttons/action-dropdown.component.ts | 20 ++++++++++ .../src/app/shared/buttons/button.component.scss | 43 ++++++++++++++++++++++ .../shared/buttons/delete-button.component.html | 6 +++ .../app/shared/buttons/delete-button.component.ts | 11 ++++++ .../app/shared/buttons/edit-button.component.html | 6 +++ .../app/shared/buttons/edit-button.component.ts | 12 ++++++ 8 files changed, 135 insertions(+) create mode 100644 client/src/app/shared/buttons/action-dropdown.component.html create mode 100644 client/src/app/shared/buttons/action-dropdown.component.scss create mode 100644 client/src/app/shared/buttons/action-dropdown.component.ts create mode 100644 client/src/app/shared/buttons/button.component.scss create mode 100644 client/src/app/shared/buttons/delete-button.component.html create mode 100644 client/src/app/shared/buttons/delete-button.component.ts create mode 100644 client/src/app/shared/buttons/edit-button.component.html create mode 100644 client/src/app/shared/buttons/edit-button.component.ts (limited to 'client/src/app/shared/buttons') diff --git a/client/src/app/shared/buttons/action-dropdown.component.html b/client/src/app/shared/buttons/action-dropdown.component.html new file mode 100644 index 000000000..c87ba4c82 --- /dev/null +++ b/client/src/app/shared/buttons/action-dropdown.component.html @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/buttons/action-dropdown.component.scss new file mode 100644 index 000000000..cc459b972 --- /dev/null +++ b/client/src/app/shared/buttons/action-dropdown.component.scss @@ -0,0 +1,21 @@ +@import '_variables'; +@import '_mixins'; + +.action-button { + @include peertube-button; + @include grey-button; + + &:hover, &:active, &:focus { + background-color: $grey-color; + } + + display: inline-block; + padding: 0 10px; + + .icon-action { + @include icon(21px); + + background-image: url('../../../assets/images/video/more.svg'); + top: -1px; + } +} \ No newline at end of file diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts new file mode 100644 index 000000000..407d24b80 --- /dev/null +++ b/client/src/app/shared/buttons/action-dropdown.component.ts @@ -0,0 +1,20 @@ +import { Component, Input } from '@angular/core' + +export type DropdownAction = { + type: 'custom' | 'delete' | 'edit' + label?: string + handler?: (T) => any + linkBuilder?: (T) => (string | number)[] + iconClass?: string +} + +@Component({ + selector: 'my-action-dropdown', + styleUrls: [ './action-dropdown.component.scss' ], + templateUrl: './action-dropdown.component.html' +}) + +export class ActionDropdownComponent { + @Input() actions: DropdownAction[] = [] + @Input() entry: T +} diff --git a/client/src/app/shared/buttons/button.component.scss b/client/src/app/shared/buttons/button.component.scss new file mode 100644 index 000000000..343aea207 --- /dev/null +++ b/client/src/app/shared/buttons/button.component.scss @@ -0,0 +1,43 @@ +@import '_variables'; +@import '_mixins'; + +.action-button { + @include peertube-button-link; + + font-size: 15px; + font-weight: $font-semibold; + color: #585858; + background-color: #E5E5E5; + + &:hover { + background-color: #EFEFEF; + } + + .icon { + @include icon(21px); + + position: relative; + top: -2px; + + &.icon-edit { + background-image: url('../../../assets/images/global/edit-grey.svg'); + } + + &.icon-delete-grey { + background-image: url('../../../assets/images/global/delete-grey.svg'); + } + } +} + +// In a table, try to minimize the space taken by this button +@media screen and (max-width: 1400px) { + :host-context(td) { + .action-button { + padding: 0 13px; + } + + .button-label { + display: none; + } + } +} diff --git a/client/src/app/shared/buttons/delete-button.component.html b/client/src/app/shared/buttons/delete-button.component.html new file mode 100644 index 000000000..792490219 --- /dev/null +++ b/client/src/app/shared/buttons/delete-button.component.html @@ -0,0 +1,6 @@ + + + + {{ label }} + Delete + diff --git a/client/src/app/shared/buttons/delete-button.component.ts b/client/src/app/shared/buttons/delete-button.component.ts new file mode 100644 index 000000000..cd2bcccdf --- /dev/null +++ b/client/src/app/shared/buttons/delete-button.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core' + +@Component({ + selector: 'my-delete-button', + styleUrls: [ './button.component.scss' ], + templateUrl: './delete-button.component.html' +}) + +export class DeleteButtonComponent { + @Input() label: string +} diff --git a/client/src/app/shared/buttons/edit-button.component.html b/client/src/app/shared/buttons/edit-button.component.html new file mode 100644 index 000000000..7efc54ce7 --- /dev/null +++ b/client/src/app/shared/buttons/edit-button.component.html @@ -0,0 +1,6 @@ + + + + {{ label }} + Edit + diff --git a/client/src/app/shared/buttons/edit-button.component.ts b/client/src/app/shared/buttons/edit-button.component.ts new file mode 100644 index 000000000..7abaacc26 --- /dev/null +++ b/client/src/app/shared/buttons/edit-button.component.ts @@ -0,0 +1,12 @@ +import { Component, Input } from '@angular/core' + +@Component({ + selector: 'my-edit-button', + styleUrls: [ './button.component.scss' ], + templateUrl: './edit-button.component.html' +}) + +export class EditButtonComponent { + @Input() label: string + @Input() routerLink = [] +} -- cgit v1.2.3