From 67ed6552b831df66713bac9e672738796128d33f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Jun 2020 14:10:17 +0200 Subject: Reorganize client shared modules --- .../shared/buttons/action-dropdown.component.html | 55 ----------------- .../shared/buttons/action-dropdown.component.scss | 72 ---------------------- .../shared/buttons/action-dropdown.component.ts | 52 ---------------- .../src/app/shared/buttons/button.component.html | 6 -- .../src/app/shared/buttons/button.component.scss | 46 -------------- client/src/app/shared/buttons/button.component.ts | 20 ------ .../shared/buttons/delete-button.component.html | 6 -- .../app/shared/buttons/delete-button.component.ts | 20 ------ .../app/shared/buttons/edit-button.component.html | 6 -- .../app/shared/buttons/edit-button.component.ts | 12 ---- 10 files changed, 295 deletions(-) delete mode 100644 client/src/app/shared/buttons/action-dropdown.component.html delete mode 100644 client/src/app/shared/buttons/action-dropdown.component.scss delete mode 100644 client/src/app/shared/buttons/action-dropdown.component.ts delete mode 100644 client/src/app/shared/buttons/button.component.html delete mode 100644 client/src/app/shared/buttons/button.component.scss delete mode 100644 client/src/app/shared/buttons/button.component.ts delete mode 100644 client/src/app/shared/buttons/delete-button.component.html delete mode 100644 client/src/app/shared/buttons/delete-button.component.ts delete mode 100644 client/src/app/shared/buttons/edit-button.component.html delete 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 deleted file mode 100644 index 12933d4ca..000000000 --- a/client/src/app/shared/buttons/action-dropdown.component.html +++ /dev/null @@ -1,55 +0,0 @@ - diff --git a/client/src/app/shared/buttons/action-dropdown.component.scss b/client/src/app/shared/buttons/action-dropdown.component.scss deleted file mode 100644 index 724a04efc..000000000 --- a/client/src/app/shared/buttons/action-dropdown.component.scss +++ /dev/null @@ -1,72 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -.dropdown-divider:last-child { - display: none; -} - -.action-button { - @include peertube-button; - - &.button-styled { - - &.grey { - @include grey-button; - } - - &.orange { - @include orange-button; - } - - &:hover, &:active, &:focus { - background-color: $grey-background-color; - } - } - - display: inline-block; - padding: 0 10px; - - &::after { - display: none; - } - - .more-icon { - width: 21px; - - ::ng-deep { - @include apply-svg-color(pvar(--actionButtonColor)); - } - } - - &.small { - font-size: 14px; - height: 20px; - line-height: 20px; - } -} - -.dropdown-toggle::after { - position: relative; - top: 1px; -} - -.dropdown-menu { - .dropdown-header { - padding: 0.2rem 1rem; - } - - .dropdown-item { - display: flex; - cursor: pointer; - color: #000 !important; - - &.with-icon { - @include dropdown-with-icon-item; - } - - a, span { - display: block; - width: 100%; - } - } -} diff --git a/client/src/app/shared/buttons/action-dropdown.component.ts b/client/src/app/shared/buttons/action-dropdown.component.ts deleted file mode 100644 index 15f9556dc..000000000 --- a/client/src/app/shared/buttons/action-dropdown.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Component, Input } from '@angular/core' -import { GlobalIconName } from '@app/shared/images/global-icon.component' - -export type DropdownAction = { - label?: string - iconName?: GlobalIconName - description?: string - title?: string - handler?: (a: T) => any - linkBuilder?: (a: T) => (string | number)[] - isDisplayed?: (a: T) => boolean - isHeader?: boolean -} - -export type DropdownButtonSize = 'normal' | 'small' -export type DropdownTheme = 'orange' | 'grey' -export type DropdownDirection = 'horizontal' | 'vertical' - -@Component({ - selector: 'my-action-dropdown', - styleUrls: [ './action-dropdown.component.scss' ], - templateUrl: './action-dropdown.component.html' -}) - -export class ActionDropdownComponent { - @Input() actions: DropdownAction[] | DropdownAction[][] = [] - @Input() entry: T - - @Input() placement = 'bottom-left auto' - @Input() container: null | 'body' - - @Input() buttonSize: DropdownButtonSize = 'normal' - @Input() buttonDirection: DropdownDirection = 'horizontal' - @Input() buttonStyled = true - - @Input() label: string - @Input() theme: DropdownTheme = 'grey' - - getActions (): DropdownAction[][] { - if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions as DropdownAction[][] - - return [ this.actions as DropdownAction[] ] - } - - areActionsDisplayed (actions: Array | DropdownAction[]>, entry: T): boolean { - return actions.some(a => { - if (Array.isArray(a)) return this.areActionsDisplayed(a, entry) - - return a.isDisplayed === undefined || a.isDisplayed(entry) - }) - } -} diff --git a/client/src/app/shared/buttons/button.component.html b/client/src/app/shared/buttons/button.component.html deleted file mode 100644 index d2b0eb81a..000000000 --- a/client/src/app/shared/buttons/button.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - {{ label }} - diff --git a/client/src/app/shared/buttons/button.component.scss b/client/src/app/shared/buttons/button.component.scss deleted file mode 100644 index 3ccfefd7e..000000000 --- a/client/src/app/shared/buttons/button.component.scss +++ /dev/null @@ -1,46 +0,0 @@ -@import '_variables'; -@import '_mixins'; - -my-small-loader ::ng-deep .root { - display: inline-block; - margin: 0 3px 0 0; - width: 20px; -} - -.action-button { - @include peertube-button-link; - @include button-with-icon(21px, 0, -2px); -} - -.orange-button { - @include peertube-button; - @include orange-button; -} - -.orange-button-link { - @include peertube-button-link; - @include orange-button; -} - -.grey-button { - @include peertube-button; - @include grey-button; -} - -.grey-button-link { - @include peertube-button-link; - @include grey-button; -} - -// 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/button.component.ts b/client/src/app/shared/buttons/button.component.ts deleted file mode 100644 index cac5ad210..000000000 --- a/client/src/app/shared/buttons/button.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component, Input } from '@angular/core' -import { GlobalIconName } from '@app/shared/images/global-icon.component' - -@Component({ - selector: 'my-button', - styleUrls: ['./button.component.scss'], - templateUrl: './button.component.html' -}) - -export class ButtonComponent { - @Input() label = '' - @Input() className = 'grey-button' - @Input() icon: GlobalIconName = undefined - @Input() title: string = undefined - @Input() loading = false - - getTitle () { - return this.title || this.label - } -} diff --git a/client/src/app/shared/buttons/delete-button.component.html b/client/src/app/shared/buttons/delete-button.component.html deleted file mode 100644 index 398b6db1e..000000000 --- a/client/src/app/shared/buttons/delete-button.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - {{ label }} - Delete - diff --git a/client/src/app/shared/buttons/delete-button.component.ts b/client/src/app/shared/buttons/delete-button.component.ts deleted file mode 100644 index 39e31900f..000000000 --- a/client/src/app/shared/buttons/delete-button.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core' -import { I18n } from '@ngx-translate/i18n-polyfill' - -@Component({ - selector: 'my-delete-button', - styleUrls: [ './button.component.scss' ], - templateUrl: './delete-button.component.html' -}) - -export class DeleteButtonComponent implements OnInit { - @Input() label: string - - title: string - - constructor (private i18n: I18n) { } - - ngOnInit () { - this.title = this.label || this.i18n('Delete') - } -} diff --git a/client/src/app/shared/buttons/edit-button.component.html b/client/src/app/shared/buttons/edit-button.component.html deleted file mode 100644 index b852bb38a..000000000 --- a/client/src/app/shared/buttons/edit-button.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - {{ label }} - Edit - diff --git a/client/src/app/shared/buttons/edit-button.component.ts b/client/src/app/shared/buttons/edit-button.component.ts deleted file mode 100644 index 9cfe1a3bb..000000000 --- a/client/src/app/shared/buttons/edit-button.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -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: string[] | string = [] -} -- cgit v1.2.3