Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

style: simpler layout

Christian Fei26acc893fe58
diff --git a/client/components/search-videos.js b/client/components/search-videos.js
index 01dfed4..5b9725e 100644
--- a/client/components/search-videos.js
+++ b/client/components/search-videos.js
@@ -19,7 +19,7 @@ class SearchVideos extends HTMLElement {
this.querySelector('input').removeEventListener('keyup', this.searchHandler.bind(this))
}
render () {
- this.innerHTML = /*html*/`<input type="search" incremental="incremental" id="search" placeholder="Search videos or paste video url" autofocus>`
+ this.innerHTML = /*html*/`<input type="search" incremental="incremental" id="search" class="p-v" placeholder="πŸ” Search videos or paste video url" autofocus>`
}
searchHandler (event) {
event.preventDefault()
diff --git a/client/index.html b/client/index.html
index 69877ab..e0e53fd 100644
--- a/client/index.html
+++ b/client/index.html
@@ -9,15 +9,15 @@
</head>
<body>
<header>
- <div class="flex space-between">
- <h1><a href="/">My-YT</a></h1>
+ <div class="flex space-between p-1">
+ <a id="home-link" class="hide p-v" href="/">go back home</a></h1>
+ <div class="flex-1 p-v"></div>
<search-videos></search-videos>
- <div>
+ <div class="flex-1 tar p-v">
<a href="/settings">Settings</a>
<a tabindex="-1" href="https://github.com/christian-fei/my-yt" target="_blank">πŸ“–</a>
</div>
</div>
- <channels-list></channels-list>
</header>
<main></main>
@@ -33,6 +33,7 @@
</dialog>
<template id="main-template">
+ <channels-list></channels-list>
<div id="filter-results-status"></div>
<video-filters></video-filters>
<div class="main-videos-container"></div>
diff --git a/client/lib/router.js b/client/lib/router.js
index f3bb617..21d62bc 100644
--- a/client/lib/router.js
+++ b/client/lib/router.js
@@ -2,7 +2,7 @@ const routes = {
'/': { template: document.getElementById('main-template'), async initialize() {
console.log('initialize /')
- document.querySelector('channels-list').classList.remove('hide')
+ document.getElementById('home-link').classList.add('hide')
let $videosContainer = document.querySelector('.main-videos-container')
let videos = await fetch('/api/videos').then(res => res.json())
@@ -42,7 +42,7 @@ const routes = {
'/settings': { template: document.getElementById('settings-template'), async initialize () {
console.log('initalize /settings')
- document.querySelector('channels-list').classList.add('hide')
+ document.getElementById('home-link').classList.remove('hide')
document.getElementById('search').setAttribute('disabled', 'disabled')
document.getElementById('search').classList.add('hide')
@@ -73,8 +73,6 @@ const routes = {
'/404': { template: document.getElementById('not-found-template'), async initialize () {
document.getElementById('search').setAttribute('disabled', 'disabled')
document.getElementById('search').classList.add('hide')
-
- document.querySelector('channels-list').classList.add('hide')
} }
}
diff --git a/client/main.css b/client/main.css
index 9603afb..e6efb54 100644
--- a/client/main.css
+++ b/client/main.css
@@ -34,6 +34,10 @@ a {
.p-1 {
padding: 0.5rem;
}
+.p-v {
+ padding-top: 0.5rem;
+ padding-bottom: 0.5rem;
+}
.m-0 {
margin: 0;
}
@@ -42,7 +46,12 @@ a {
display: flex;
justify-content: space-around;
align-items: center;
- margin-top: 0.3em;
+}
+.flex-1 {
+ flex: 1;
+}
+.flex-2 {
+ flex: 2;
}
.space-between {
justify-content: space-between;
@@ -50,6 +59,9 @@ a {
.direction-col {
flex-direction: column;
}
+.tar {
+ text-align: right;
+}
.hide {
@@ -67,13 +79,10 @@ form {
margin-bottom: 20px;
}
input[type="text"], input[type="url"], input[type="search"] {
- /*basic styles so that the user can enter text easily, keep in mind that the body background is white*/
background-color: #f5f5f5;
color: #000;
- padding: 5px;
+ /* padding: 5px; */
border-radius: 3px;
- /* width: 100%; */
- box-sizing: border-box; /*so that padding doesn't affect the width*/
}
.loader {
@@ -319,17 +328,15 @@ body > header {
position: sticky;
top: 0;
z-index: 9000;
- /*
- display: flex;
- justify-content: space-between;
- align-items: center;
- */
padding: 1em 0.5em;
margin-bottom: 3rem;
overflow: hidden;
background-color: inherit;
- /* box-shadow on the bottom border */
- box-shadow: 0px 5px 10px rgba(119, 118, 118, 0.2);
+ font-size: 1.15rem;
+}
+body > header > * {
+ padding-top: .5rem;
+ padding-bottom: .5rem;
}
search-videos {
@@ -339,10 +346,11 @@ search-videos {
#search {
display: block;
margin: 0 auto;
- width: 90%;
- flex: 2;
- padding: 1em;
- font-size: 1.1rem;
+ width: 100%;
+ border: 0;
+ outline: 0;
+ margin: 0;
+ padding: 0 .5rem;
}