Add help tooltip
[oweals/peertube.git] / client / src / app / shared / misc / help.component.ts
1 import { Component, Input, OnInit } from '@angular/core'
2
3 @Component({
4   selector: 'my-help',
5   styleUrls: [ './help.component.scss' ],
6   templateUrl: './help.component.html'
7 })
8
9 export class HelpComponent implements OnInit {
10   @Input() preHtml = ''
11   @Input() postHtml = ''
12   @Input() customHtml = ''
13   @Input() helpType: 'custom' | 'markdownText' | 'markdownEnhanced' = 'custom'
14
15   mainHtml = ''
16
17   ngOnInit () {
18     if (this.helpType === 'custom') {
19       this.mainHtml = this.customHtml
20       return
21     }
22
23     if (this.helpType === 'markdownText') {
24       this.mainHtml = 'Markdown compatible.<br /><br />' +
25         'Supports:' +
26         '<ul>' +
27         '<li>Links</li>' +
28         '<li>Lists</li>' +
29         '<li>Emphasis</li>' +
30         '</ul>'
31       return
32     }
33
34     if (this.helpType === 'markdownEnhanced') {
35       this.mainHtml = 'Markdown compatible.<br /><br />' +
36         'Supports:' +
37         '<ul>' +
38         '<li>Links</li>' +
39         '<li>Lists</li>' +
40         '<li>Emphasis</li>' +
41         '<li>Images</li>' +
42         '</ul>'
43       return
44     }
45   }
46 }