forked from extern/homer
Vertical layout support
This commit is contained in:
parent
9baec9aec2
commit
4877ec98e6
21
app.css
21
app.css
@ -11,7 +11,7 @@ body {
|
||||
font-size: 2rem; }
|
||||
body h2 {
|
||||
font-size: 1.7rem;
|
||||
margin-top: 3rem;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem; }
|
||||
body h2 .fas, body h2 .fab, body h2 .far {
|
||||
margin-right: 10px; }
|
||||
@ -92,6 +92,8 @@ body {
|
||||
border: none;
|
||||
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1);
|
||||
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms; }
|
||||
body .card a {
|
||||
outline: none; }
|
||||
body .card:hover {
|
||||
background-color: #FFFFFF;
|
||||
transform: translate(0, -3px); }
|
||||
@ -102,17 +104,26 @@ body {
|
||||
body .card-content {
|
||||
height: 85px;
|
||||
padding: 1.3rem; }
|
||||
body .layout-vertical .card {
|
||||
border-radius: 0; }
|
||||
body .layout-vertical .column div:first-of-type .card {
|
||||
border-radius: 5px 5px 0 0; }
|
||||
body .layout-vertical .column div:last-child .card {
|
||||
border-radius: 0 0 5px 5px; }
|
||||
body .footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 1rem 0.5rem;
|
||||
padding: 0.5rem;
|
||||
text-align: left;
|
||||
background-color: #fafafa;
|
||||
border-top: 1px solid #F5F5F5; }
|
||||
border-top: 1px solid #F5F5F5;
|
||||
color: #676767;
|
||||
font-size: 0.85rem; }
|
||||
body .search-bar {
|
||||
position: relative; }
|
||||
position: relative;
|
||||
display: inline-block; }
|
||||
body .search-bar #search {
|
||||
border: none;
|
||||
background-color: #5f98f6;
|
||||
@ -137,6 +148,8 @@ body {
|
||||
height: 20px; }
|
||||
body .search-bar:focus-within .search-label::before {
|
||||
color: #4a4a4a; }
|
||||
body .icon-button {
|
||||
display: inline-block; }
|
||||
body .offline-message {
|
||||
text-align: center;
|
||||
margin: 35px 0; }
|
||||
|
29
app.js
29
app.js
@ -4,6 +4,7 @@ const app = new Vue({
|
||||
config: null,
|
||||
offline: false,
|
||||
filter: '',
|
||||
vlayout: true
|
||||
},
|
||||
created: function () {
|
||||
let that = this;
|
||||
@ -46,6 +47,34 @@ const app = new Vue({
|
||||
}
|
||||
});
|
||||
|
||||
Vue.component('service', {
|
||||
props: ['item'],
|
||||
template: `<div>
|
||||
<div class="card">
|
||||
<a :href="item.url">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="item.icon"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">{{ item.subtitle }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<strong class="tag" v-if="item.tag">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</a>
|
||||
</div></div>`
|
||||
});
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('/worker.js');
|
||||
|
31
app.scss
31
app.scss
@ -18,7 +18,7 @@ body {
|
||||
|
||||
h2 {
|
||||
font-size: 1.7rem;
|
||||
margin-top: 3rem;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
.fas, .fab, .far {
|
||||
@ -147,7 +147,11 @@ body {
|
||||
border-radius: 5px;
|
||||
border: none;
|
||||
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1);
|
||||
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms
|
||||
transition: cubic-bezier(0.165, 0.84, 0.44, 1) 300ms;
|
||||
|
||||
a {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
@ -166,19 +170,36 @@ body {
|
||||
padding: 1.3rem;
|
||||
}
|
||||
|
||||
.layout-vertical {
|
||||
.card {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.column div:first-of-type .card {
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.column div:last-child .card {
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 1rem 0.5rem;
|
||||
padding: 0.5rem;
|
||||
text-align: left;
|
||||
background-color: #fafafa;
|
||||
border-top: 1px solid #F5F5F5;
|
||||
color: #676767;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
#search {
|
||||
border: none;
|
||||
background-color: lighten( $secondary-color, 6% );
|
||||
@ -213,6 +234,10 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.offline-message {
|
||||
text-align: center;
|
||||
margin: 35px 0;
|
||||
|
59
index.html
59
index.html
@ -7,8 +7,8 @@
|
||||
<meta name="robots" content="noindex">
|
||||
<link rel="icon" type="image/png" href="assets/favicon.png">
|
||||
<title>Homer</title>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
|
||||
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
|
||||
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato|Raleway" rel="stylesheet">
|
||||
<link rel="stylesheet" href="app.css">
|
||||
@ -40,6 +40,8 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="end">
|
||||
<a v-on:click="vlayout = !vlayout" class="icon-button navbar-item"><i
|
||||
:class="['fas', vlayout ? 'fa-list' : 'fa-columns']"></i></a>
|
||||
<div class="search-bar">
|
||||
<label for="search" class="search-label"></label>
|
||||
<input type="text" id="search" v-model="filter" />
|
||||
@ -70,39 +72,30 @@
|
||||
|
||||
<h2 v-if="filter"><i class="fas fa-search"></i> Search</h2>
|
||||
|
||||
<div v-for="(group, index) in config.services">
|
||||
<h2 v-if="!filter && group.name"><i v-if="group.icon" :class="group.icon"></i><span v-else>#</span>
|
||||
{{ group.name }}</h2>
|
||||
<div class="columns is-multiline">
|
||||
<div v-for="item in group.items"
|
||||
v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))"
|
||||
class="column is-one-third-widescreen">
|
||||
<div v-if='item' class="card">
|
||||
<a :href="item.url">
|
||||
<div class="card-content">
|
||||
<div class="media">
|
||||
<div v-if="item.logo" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<img :src="item.logo" />
|
||||
</figure>
|
||||
</div>
|
||||
<div v-if="item.icon" class="media-left">
|
||||
<figure class="image is-48x48">
|
||||
<i style="font-size: 35px" :class="item.icon"></i>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">{{ item.subtitle }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<strong class="tag" v-if="item.tag">#{{ item.tag }}</strong>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Horizontal layout -->
|
||||
<div v-if="!vlayout || filter" class="columns is-multiline">
|
||||
<template v-for="(group, index) in config.services">
|
||||
<h2 v-if="!filter && group.name" class="column is-full"><i v-if="group.icon" :class="group.icon"></i><span
|
||||
v-else>#</span>
|
||||
{{ group.name }}</h2>
|
||||
<service v-for="item in group.items" v-bind:item="item" class="column is-one-third-widescreen"
|
||||
v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))">
|
||||
</service>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Vertical layout -->
|
||||
<div v-if="!filter && vlayout" class="columns is-multiline layout-vertical">
|
||||
<div class="column is-one-third-widescreen" v-for="(group, index) in config.services">
|
||||
<h2 v-if="!filter && group.name"><i v-if="group.icon" :class="group.icon"></i><span v-else>#</span>
|
||||
{{ group.name }}</h2>
|
||||
<service v-for="item in group.items" v-bind:item="item"
|
||||
v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))">
|
||||
</service>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user