Vertical layout support

pull/1/head
Bastien Wirtz 2019-02-19 22:20:46 -08:00
parent 9baec9aec2
commit 4877ec98e6
4 changed files with 100 additions and 40 deletions

21
app.css
View File

@ -11,7 +11,7 @@ body {
font-size: 2rem; } font-size: 2rem; }
body h2 { body h2 {
font-size: 1.7rem; font-size: 1.7rem;
margin-top: 3rem; margin-top: 2rem;
margin-bottom: 1rem; } margin-bottom: 1rem; }
body h2 .fas, body h2 .fab, body h2 .far { body h2 .fas, body h2 .fab, body h2 .far {
margin-right: 10px; } margin-right: 10px; }
@ -92,6 +92,8 @@ body {
border: none; border: none;
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1); 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; }
body .card a {
outline: none; }
body .card:hover { body .card:hover {
background-color: #FFFFFF; background-color: #FFFFFF;
transform: translate(0, -3px); } transform: translate(0, -3px); }
@ -102,17 +104,26 @@ body {
body .card-content { body .card-content {
height: 85px; height: 85px;
padding: 1.3rem; } 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 { body .footer {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: 1rem 0.5rem; padding: 0.5rem;
text-align: left; text-align: left;
background-color: #fafafa; background-color: #fafafa;
border-top: 1px solid #F5F5F5; } border-top: 1px solid #F5F5F5;
color: #676767;
font-size: 0.85rem; }
body .search-bar { body .search-bar {
position: relative; } position: relative;
display: inline-block; }
body .search-bar #search { body .search-bar #search {
border: none; border: none;
background-color: #5f98f6; background-color: #5f98f6;
@ -137,6 +148,8 @@ body {
height: 20px; } height: 20px; }
body .search-bar:focus-within .search-label::before { body .search-bar:focus-within .search-label::before {
color: #4a4a4a; } color: #4a4a4a; }
body .icon-button {
display: inline-block; }
body .offline-message { body .offline-message {
text-align: center; text-align: center;
margin: 35px 0; } margin: 35px 0; }

29
app.js
View File

@ -4,6 +4,7 @@ const app = new Vue({
config: null, config: null,
offline: false, offline: false,
filter: '', filter: '',
vlayout: true
}, },
created: function () { created: function () {
let that = this; 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) { if ('serviceWorker' in navigator) {
window.addEventListener('load', function () { window.addEventListener('load', function () {
navigator.serviceWorker.register('/worker.js'); navigator.serviceWorker.register('/worker.js');

View File

@ -18,7 +18,7 @@ body {
h2 { h2 {
font-size: 1.7rem; font-size: 1.7rem;
margin-top: 3rem; margin-top: 2rem;
margin-bottom: 1rem; margin-bottom: 1rem;
.fas, .fab, .far { .fas, .fab, .far {
@ -147,7 +147,11 @@ body {
border-radius: 5px; border-radius: 5px;
border: none; border: none;
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1); 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 { .card:hover {
@ -166,19 +170,36 @@ body {
padding: 1.3rem; 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 { .footer {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: 1rem 0.5rem; padding: 0.5rem;
text-align: left; text-align: left;
background-color: #fafafa; background-color: #fafafa;
border-top: 1px solid #F5F5F5; border-top: 1px solid #F5F5F5;
color: #676767;
font-size: 0.85rem;
} }
.search-bar { .search-bar {
position: relative; position: relative;
display: inline-block;
#search { #search {
border: none; border: none;
background-color: lighten( $secondary-color, 6% ); background-color: lighten( $secondary-color, 6% );
@ -213,6 +234,10 @@ body {
} }
} }
.icon-button {
display: inline-block;
}
.offline-message { .offline-message {
text-align: center; text-align: center;
margin: 35px 0; margin: 35px 0;

View File

@ -7,8 +7,8 @@
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<link rel="icon" type="image/png" href="assets/favicon.png"> <link rel="icon" type="image/png" href="assets/favicon.png">
<title>Homer</title> <title>Homer</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous"> integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css"> <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 href="https://fonts.googleapis.com/css?family=Lato|Raleway" rel="stylesheet">
<link rel="stylesheet" href="app.css"> <link rel="stylesheet" href="app.css">
@ -40,6 +40,8 @@
</a> </a>
</div> </div>
<div class="end"> <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"> <div class="search-bar">
<label for="search" class="search-label"></label> <label for="search" class="search-label"></label>
<input type="text" id="search" v-model="filter" /> <input type="text" id="search" v-model="filter" />
@ -70,39 +72,30 @@
<h2 v-if="filter"><i class="fas fa-search"></i> Search</h2> <h2 v-if="filter"><i class="fas fa-search"></i> Search</h2>
<div v-for="(group, index) in config.services"> <!-- Horizontal layout -->
<h2 v-if="!filter && group.name"><i v-if="group.icon" :class="group.icon"></i><span v-else>#</span> <div v-if="!vlayout || filter" class="columns is-multiline">
{{ group.name }}</h2> <template v-for="(group, index) in config.services">
<div class="columns is-multiline"> <h2 v-if="!filter && group.name" class="column is-full"><i v-if="group.icon" :class="group.icon"></i><span
<div v-for="item in group.items" v-else>#</span>
v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))" {{ group.name }}</h2>
class="column is-one-third-widescreen"> <service v-for="item in group.items" v-bind:item="item" class="column is-one-third-widescreen"
<div v-if='item' class="card"> v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))">
<a :href="item.url"> </service>
<div class="card-content"> </template>
<div class="media"> </div>
<div v-if="item.logo" class="media-left">
<figure class="image is-48x48"> <!-- Vertical layout -->
<img :src="item.logo" /> <div v-if="!filter && vlayout" class="columns is-multiline layout-vertical">
</figure> <div class="column is-one-third-widescreen" v-for="(group, index) in config.services">
</div> <h2 v-if="!filter && group.name"><i v-if="group.icon" :class="group.icon"></i><span v-else>#</span>
<div v-if="item.icon" class="media-left"> {{ group.name }}</h2>
<figure class="image is-48x48"> <service v-for="item in group.items" v-bind:item="item"
<i style="font-size: 35px" :class="item.icon"></i> v-if="!filter || (item && (item.name.toLowerCase().includes(filter.toLowerCase()) || (item.tag && item.tag.toLowerCase().includes(filter.toLowerCase()))))">
</figure> </service>
</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>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</section> </section>