Added icon component. Stylized filter bar.

This commit is contained in:
ThePendulum 2019-10-28 02:54:37 +01:00
parent df2e13f091
commit 5f853792b8
9 changed files with 321 additions and 111 deletions

View File

@ -18,7 +18,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.container { .container {
height: 100%; height: 100%;
display: flex; display: flex;
@ -27,11 +27,15 @@ export default {
} }
.content { .content {
display: flex;
flex-direction: column;
flex-grow: 1; flex-grow: 1;
overflow-y: auto; overflow: hidden;
} }
.content-inner { .content-inner {
flex-grow: 1;
padding: 1rem; padding: 1rem;
overflow-y: auto;
} }
</style> </style>

View File

@ -1,34 +1,51 @@
<template> <template>
<div class="content-inner"> <div class="content">
<div class="filters-bar"> <div class="filters-bar noselect">
Content: <Icon icon="filter" />
<ul class="filters"> <ul class="filters">
<li> <li class="filter">
<label> <label
class="toggle"
:class="{ active: showLesbian }"
>
<input <input
v-model="showLesbian"
type="checkbox" type="checkbox"
>Lesbian class="check"
>lesbian
</label> </label>
</li> </li>
<li>
<label> <li class="filter">
<label
class="toggle"
:class="{ active: showGay }"
>
<input <input
v-model="showGay"
type="checkbox" type="checkbox"
>Gay class="check"
>gay
</label> </label>
</li> </li>
<li>
<label> <li class="filter">
<label
class="toggle"
:class="{ active: showTrans }"
>
<input <input
v-model="showTrans"
type="checkbox" type="checkbox"
>Transsexual class="check"
>trans
</label> </label>
</li> </li>
</ul> </ul>
</div> </div>
<h2 class="heading">Latest releases</h2> <div class="content-inner">
<ul class="scenes nolist"> <ul class="scenes nolist">
<li <li
v-for="release in releases" v-for="release in releases"
@ -115,7 +132,7 @@
<ul class="scene-tags nolist"> <ul class="scene-tags nolist">
<li <li
v-for="tag in release.tags" v-for="tag in release.tags"
:key="`tag-${tag.id}`" :key="`tag-${tag.slug}`"
class="scene-tag" class="scene-tag"
> >
<a <a
@ -131,6 +148,7 @@
</li> </li>
</ul> </ul>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -145,6 +163,9 @@ async function mounted() {
export default { export default {
data() { data() {
return { return {
showLesbian: true,
showGay: false,
showTrans: false,
releases: [], releases: [],
}; };
}, },
@ -158,6 +179,47 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import 'theme'; @import 'theme';
.filters-bar {
display: block;
background: $shadow-hint;
padding: .5rem 1rem;
.icon {
fill: $shadow;
}
}
.filters {
display: inline-block;
list-style: none;
padding: .5rem;
margin: 0;
.toggle {
color: $shadow;
background: $shadow-hint;
box-sizing: border-box;
padding: .5rem;
border-radius: .5rem;
font-size: .9rem;
font-weight: bold;
cursor: pointer;
.check {
display: none;
}
&.active {
color: $text-contrast;
background: $primary;
}
}
}
.filter {
display: inline-block;
}
.scenes { .scenes {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));

View File

@ -0,0 +1,61 @@
<template>
<div
:title="label"
:class="{ active }"
class="icon"
v-html="svg"
/>
</template>
<script>
export default {
props: {
icon: {
type: String,
default: null,
},
label: {
type: String,
default: null,
},
active: {
type: Boolean,
default: false,
},
},
data() {
return {
svg: null,
};
},
beforeMount() {
this.svg = require(`../../img/${this.icon}.svg`).default;
},
};
</script>
<style lang="scss">
@import '../../css/theme';
.icon {
fill: $text;
display: inline-block;
flex-shrink: 0;
width: 1rem;
height: 1rem;
svg {
width: 100%;
height: 100%;
}
&.active {
fill: $shadow;
&:hover {
fill: $text;
cursor: pointer;
}
}
}
</style>

7
assets/css/_states.scss Normal file
View File

@ -0,0 +1,7 @@
.noselect {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-tap-highlight-color: transparent;
}

View File

@ -1,4 +1,5 @@
@import 'theme'; @import 'theme';
@import 'states';
html, html,
body { body {

5
assets/img/filter.svg Normal file
View File

@ -0,0 +1,5 @@
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<title>filter</title>
<path d="M16 0c-8.837 0-16 2.239-16 5v3l12 12v10c0 1.105 1.791 2 4 2s4-0.895 4-2v-10l12-12v-3c0-2.761-7.163-5-16-5zM2.95 4.338c0.748-0.427 1.799-0.832 3.040-1.171 2.748-0.752 6.303-1.167 10.011-1.167s7.262 0.414 10.011 1.167c1.241 0.34 2.292 0.745 3.040 1.171 0.494 0.281 0.76 0.519 0.884 0.662-0.124 0.142-0.391 0.38-0.884 0.662-0.748 0.427-1.8 0.832-3.040 1.171-2.748 0.752-6.303 1.167-10.011 1.167s-7.262-0.414-10.011-1.167c-1.24-0.34-2.292-0.745-3.040-1.171-0.494-0.282-0.76-0.519-0.884-0.662 0.124-0.142 0.391-0.38 0.884-0.662z"></path>
</svg>

After

Width:  |  Height:  |  Size: 702 B

View File

@ -7,11 +7,15 @@ import initStore from './store';
import '../css/style.scss'; import '../css/style.scss';
import Container from '../components/container/container.vue'; import Container from '../components/container/container.vue';
import Icon from '../components/icon/icon.vue';
function init() { function init() {
const store = initStore(router); const store = initStore(router);
Vue.mixin({ Vue.mixin({
components: {
Icon,
},
watch: { watch: {
pageTitle(title) { pageTitle(title) {
if (title) { if (title) {

View File

@ -1,3 +1,37 @@
.filters-bar[data-v-5533e378] {
display: block;
background: rgba(0, 0, 0, 0.1);
padding: .5rem 1rem;
}
.filters-bar .icon[data-v-5533e378] {
fill: rgba(0, 0, 0, 0.5);
}
.filters[data-v-5533e378] {
display: inline-block;
list-style: none;
padding: .5rem;
margin: 0;
}
.filters .toggle[data-v-5533e378] {
color: rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.1);
box-sizing: border-box;
padding: .5rem;
border-radius: .5rem;
font-size: .9rem;
font-weight: bold;
cursor: pointer;
}
.filters .toggle .check[data-v-5533e378] {
display: none;
}
.filters .toggle.active[data-v-5533e378] {
color: #fff;
background: #ff886c;
}
.filter[data-v-5533e378] {
display: inline-block;
}
.scenes[data-v-5533e378] { .scenes[data-v-5533e378] {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
@ -148,6 +182,13 @@
width: .6rem; width: .6rem;
} }
.noselect {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-tap-highlight-color: transparent; }
html, html,
body { body {
height: 100%; } height: 100%; }
@ -182,17 +223,40 @@ body {
margin: 0; margin: 0;
} }
.container[data-v-4f86a868] { .container {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
} }
.content[data-v-4f86a868] { .content {
display: flex;
flex-direction: column;
flex-grow: 1; flex-grow: 1;
overflow: hidden;
}
.content-inner {
flex-grow: 1;
padding: 1rem;
overflow-y: auto; overflow-y: auto;
} }
.content-inner[data-v-4f86a868] {
padding: 1rem; .icon {
fill: #222;
display: inline-block;
flex-shrink: 0;
width: 1rem;
height: 1rem;
}
.icon svg {
width: 100%;
height: 100%;
}
.icon.active {
fill: rgba(0, 0, 0, 0.5);
}
.icon.active:hover {
fill: #222;
cursor: pointer;
} }

View File

@ -337,6 +337,8 @@ async function fetchReleases() {
const accumulatedScenes = scenesPerSite.reduce((acc, siteScenes) => ([...acc, ...siteScenes]), []); const accumulatedScenes = scenesPerSite.reduce((acc, siteScenes) => ([...acc, ...siteScenes]), []);
const sortedScenes = accumulatedScenes.sort(({ date: dateA }, { date: dateB }) => moment(dateB).diff(dateA)); const sortedScenes = accumulatedScenes.sort(({ date: dateA }, { date: dateB }) => moment(dateB).diff(dateA));
knex.destroy();
return sortedScenes; return sortedScenes;
} }