diff options
Diffstat (limited to 'client/src/app/header')
-rw-r--r-- | client/src/app/header/header.component.html | 10 | ||||
-rw-r--r-- | client/src/app/header/header.component.scss | 58 | ||||
-rw-r--r-- | client/src/app/header/header.component.ts | 28 | ||||
-rw-r--r-- | client/src/app/header/index.ts | 1 |
4 files changed, 97 insertions, 0 deletions
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html new file mode 100644 index 000000000..c853d2b1b --- /dev/null +++ b/client/src/app/header/header.component.html | |||
@@ -0,0 +1,10 @@ | |||
1 | <input | ||
2 | type="text" id="search-video" name="search-video" placeholder="Search..." | ||
3 | [(ngModel)]="searchValue" (keyup.enter)="doSearch()" | ||
4 | > | ||
5 | <span (click)="doSearch()" class="icon icon-search"></span> | ||
6 | |||
7 | <a class="upload-button" routerLink="/videos/upload"> | ||
8 | <span class="icon icon-upload"></span> | ||
9 | <span class="upload-button-label">Upload</span> | ||
10 | </a> | ||
diff --git a/client/src/app/header/header.component.scss b/client/src/app/header/header.component.scss new file mode 100644 index 000000000..fba70dd2f --- /dev/null +++ b/client/src/app/header/header.component.scss | |||
@@ -0,0 +1,58 @@ | |||
1 | #search-video { | ||
2 | @include peertube-input-text($search-input-width); | ||
3 | margin-right: 15px; | ||
4 | padding-right: 25px; // For the search icon | ||
5 | |||
6 | &::placeholder { | ||
7 | color: #000; | ||
8 | } | ||
9 | |||
10 | @media screen and (max-width: 600px) { | ||
11 | width: calc(100% - 150px); | ||
12 | } | ||
13 | |||
14 | @media screen and (max-width: 400px) { | ||
15 | width: calc(100% - 70px); | ||
16 | } | ||
17 | } | ||
18 | |||
19 | .icon.icon-search { | ||
20 | @include icon(25px); | ||
21 | height: 21px; | ||
22 | |||
23 | background-image: url('../../assets/images/header/search.svg'); | ||
24 | |||
25 | // yolo | ||
26 | position: absolute; | ||
27 | margin-left: -50px; | ||
28 | margin-top: 5px; | ||
29 | } | ||
30 | |||
31 | .upload-button { | ||
32 | @include peertube-button-link; | ||
33 | @include orange-button; | ||
34 | |||
35 | margin-right: 25px; | ||
36 | |||
37 | .icon.icon-upload { | ||
38 | @include icon(22px); | ||
39 | |||
40 | background-image: url('../../assets/images/header/upload.svg'); | ||
41 | height: 24px; | ||
42 | vertical-align: middle; | ||
43 | margin-right: 6px; | ||
44 | } | ||
45 | |||
46 | @media screen and (max-width: 400px) { | ||
47 | margin-right: 10px; | ||
48 | padding: 0 10px; | ||
49 | |||
50 | .icon.icon-upload { | ||
51 | margin-right: 0; | ||
52 | } | ||
53 | |||
54 | .upload-button-label { | ||
55 | display: none; | ||
56 | } | ||
57 | } | ||
58 | } | ||
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts new file mode 100644 index 000000000..a903048f2 --- /dev/null +++ b/client/src/app/header/header.component.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Router } from '@angular/router' | ||
3 | import { getParameterByName } from '../shared/misc/utils' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-header', | ||
7 | templateUrl: './header.component.html', | ||
8 | styleUrls: [ './header.component.scss' ] | ||
9 | }) | ||
10 | |||
11 | export class HeaderComponent implements OnInit { | ||
12 | searchValue = '' | ||
13 | |||
14 | constructor (private router: Router) {} | ||
15 | |||
16 | ngOnInit () { | ||
17 | const searchQuery = getParameterByName('search', window.location.href) | ||
18 | if (searchQuery) this.searchValue = searchQuery | ||
19 | } | ||
20 | |||
21 | doSearch () { | ||
22 | if (!this.searchValue) return | ||
23 | |||
24 | this.router.navigate([ '/videos', 'search' ], { | ||
25 | queryParams: { search: this.searchValue } | ||
26 | }) | ||
27 | } | ||
28 | } | ||
diff --git a/client/src/app/header/index.ts b/client/src/app/header/index.ts new file mode 100644 index 000000000..d98d2d00a --- /dev/null +++ b/client/src/app/header/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './header.component' | |||