diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-28 15:23:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-28 15:23:17 +0200 |
commit | 630421392314a4d78506f060055c754dfddf220b (patch) | |
tree | 7365327d5a95350c6cc1f78f6adede70793e053f /client/src/app/shared/shared-custom-markup/button-markup.component.ts | |
parent | 5351a0584f528e4ddb9c3c99329ba88e0ca8288e (diff) | |
download | PeerTube-630421392314a4d78506f060055c754dfddf220b.tar.gz PeerTube-630421392314a4d78506f060055c754dfddf220b.tar.zst PeerTube-630421392314a4d78506f060055c754dfddf220b.zip |
Support peertube button in custom markup
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/button-markup.component.ts')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/button-markup.component.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-custom-markup/button-markup.component.ts b/client/src/app/shared/shared-custom-markup/button-markup.component.ts new file mode 100644 index 000000000..c0aab2edd --- /dev/null +++ b/client/src/app/shared/shared-custom-markup/button-markup.component.ts | |||
@@ -0,0 +1,34 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { VideoChannel } from '../shared-main' | ||
3 | |||
4 | /* | ||
5 | * Markup component that creates a button | ||
6 | */ | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-button-markup', | ||
10 | templateUrl: 'button-markup.component.html', | ||
11 | styleUrls: [ 'button-markup.component.scss' ] | ||
12 | }) | ||
13 | export class ButtonMarkupComponent { | ||
14 | @Input() theme: 'primary' | 'secondary' | ||
15 | @Input() href: string | ||
16 | @Input() label: string | ||
17 | @Input() blankTarget?: boolean | ||
18 | |||
19 | channel: VideoChannel | ||
20 | |||
21 | getTarget () { | ||
22 | if (this.blankTarget === true) return '_blank' | ||
23 | |||
24 | return '' | ||
25 | } | ||
26 | |||
27 | getClasses () { | ||
28 | const additionalClass = this.theme === 'primary' | ||
29 | ? 'orange-button' | ||
30 | : 'grey-button' | ||
31 | |||
32 | return [ 'peertube-button-link', additionalClass ] | ||
33 | } | ||
34 | } | ||