improve flex arrangement for folder list

This commit is contained in:
geoffrey45 2021-11-23 21:11:09 +03:00
parent cb1c466ed1
commit 92d0a1474b
7 changed files with 146 additions and 51 deletions

View File

@ -94,8 +94,8 @@ a {
.content { .content {
grid-area: content; grid-area: content;
border-radius: 5px; border-radius: .25em;
padding: 10px; padding: .5em;
overflow: hidden; overflow: hidden;
} }
@ -111,28 +111,22 @@ a {
/* width */ /* width */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: .5em; width: .5em;
display: none;
} }
/* Track */ /* Track */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: transparent; background: rgba(51, 51, 51, 0.459);
border-radius: 1em;
} }
/* Handle */ /* Handle */
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: var(--green); background: grey;
border-radius: 1em; border-radius: 1em;
} }
/* Handle on hover */ /* Handle on hover */
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: #21a13d; background: rgb(163, 163, 163);
}
:root {
scrollbar-color: transparent transparent !important;
scrollbar-width: none !important;
} }

View File

@ -1,9 +1,9 @@
<template> <template>
<div class="f-container"> <div class="f-container rounded">
<p>folders in this directory</p> <p>folders in this directory</p>
<div id="f-items"> <div id="f-items">
<router-link :to="{ path: '/' }" v-for="folder in folders" :key="folder"> <router-link :to="{ path: '/' }" v-for="folder in folders" :key="folder">
<div class="f-item circular"> <div class="f-item rounded">
<span class="f-item-text">{{ folder.name }}</span> <span class="f-item-text">{{ folder.name }}</span>
</div> </div>
</router-link> </router-link>
@ -25,27 +25,29 @@ export default {
<style> <style>
.f-container { .f-container {
margin-bottom: 20em; margin-bottom: 1em;
background: rgba(31, 30, 30, 0.521);
padding: 1em;
} }
#f-items { #f-items {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
border-top: 1px solid var(--seperator); border-top: 1px solid var(--seperator);
margin-top: 2em; gap: 1em;
padding-top: 1em;
} }
.f-container p { .f-container p {
text-transform: uppercase; text-transform: uppercase;
font-weight: normal; font-weight: normal;
color: rgba(255, 255, 255, 0.438); color: rgba(255, 255, 255, 0.438);
margin-bottom: 0em; margin-bottom: 1em;
} }
.f-container .f-item { .f-container .f-item {
width: 11em; min-width: 15em;
height: 5em; min-height: 5em;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -54,8 +56,6 @@ export default {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 1em; background-position: 1em;
background-size: 10% 100%; background-size: 10% 100%;
margin-top: 1em;
margin-right: 1em;
background-color: rgba(80, 80, 80, 0.247); background-color: rgba(80, 80, 80, 0.247);
} }

View File

@ -46,7 +46,7 @@ export default {};
border: none; border: none;
border-radius: 2em; border-radius: 2em;
padding-left: 1em; padding-left: 1em;
background-color: #0101016c; background-color: #4645456c;
color: rgba(255, 255, 255, 0.521); color: rgba(255, 255, 255, 0.521);
font-size: 1em; font-size: 1em;
line-height: 3em; line-height: 3em;
@ -63,6 +63,6 @@ export default {};
.folder-top .fsearch input:focus { .folder-top .fsearch input:focus {
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
outline: 0.1em solid #9d0208; outline: 0.1em solid #fafafa;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="folder"> <div class="folder">
<div class="table" ref="songtitle"> <div class="table rounded" ref="songtitle">
<table> <table>
<tr> <tr>
<th>Track</th> <th>Track</th>
@ -9,15 +9,17 @@
<th v-if="songTitleWidth > minWidth">Duration</th> <th v-if="songTitleWidth > minWidth">Duration</th>
</tr> </tr>
<tr v-for="song in songs" :key="song"> <tr v-for="song in songs" :key="song">
<td class="flex"> <td :style="{ width: songTitleWidth + 'px' }" class="flex">
<div class="album-art rounded"></div> <div class="album-art rounded"></div>
<div class="title-artist"> <div>
<span :style="{ width: songTitleWidth + 'px' }">{{ <span>{{ song.title }}</span>
song.title
}}</span>
</div> </div>
</td> </td>
<td :style="{ width: songTitleWidth + 'px' }"><span class="artist" v-for="artist in song.artists" :key="artist">{{ artist}}</span></td> <td :style="{ width: songTitleWidth + 'px' }">
<span class="artist" v-for="artist in song.artists" :key="artist">{{
artist
}}</span>
</td>
<td :style="{ width: songTitleWidth + 'px' }">{{ song.album }}</td> <td :style="{ width: songTitleWidth + 'px' }">{{ song.album }}</td>
<td <td
:style="{ width: songTitleWidth + 'px' }" :style="{ width: songTitleWidth + 'px' }"
@ -34,7 +36,7 @@
<script> <script>
import { ref } from "@vue/reactivity"; import { ref } from "@vue/reactivity";
import { onMounted, onUnmounted } from "@vue/runtime-core"; import { onMounted, onUnmounted } from "@vue/runtime-core";
import Songs from '../../data/songs.js' import Songs from "../../data/songs.js";
export default { export default {
setup() { setup() {
@ -43,17 +45,21 @@ export default {
const minWidth = ref(250); const minWidth = ref(250);
const songs = Songs.songs const songs = Songs.songs;
const resizeSongTitleWidth = () => { const resizeSongTitleWidth = () => {
songTitleWidth.value = songtitle.value.clientWidth / 3; songTitleWidth.value =
console.log(songtitle.value.clientWidth / 3); songtitle.value.clientWidth > minWidth.value * 4
? songtitle.value.clientWidth / 4
: (songTitleWidth.value = songtitle.value.clientWidth / 3);
}; };
onMounted(() => { onMounted(() => {
resizeSongTitleWidth();
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
resizeSongTitleWidth(); resizeSongTitleWidth();
}); });
console.log(songTitleWidth.value);
}); });
onUnmounted(() => { onUnmounted(() => {
@ -70,6 +76,8 @@ export default {
<style> <style>
.table { .table {
width: 100%; width: 100%;
background: transparent;
overflow: hidden;
} }
.folder .table table { .folder .table table {
@ -90,14 +98,17 @@ export default {
} }
.folder .table .flex { .folder .table .flex {
position: relative;
align-items: center; align-items: center;
justify-content: flex-start;
} }
.folder .table .flex span { .folder .table .flex > div > span {
position: absolute;
bottom: 1.5em;
width: calc(100% - 6em);
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap;
} }
td, td,
@ -105,13 +116,18 @@ th {
text-align: left; text-align: left;
padding: 8px; padding: 8px;
} }
tr:nth-child(even) {
background-color: rgba(29, 29, 29, 0.767);
}
tr:nth-child(odd) {
background-color: rgba(56, 56, 56, 0.363);
}
th { th {
text-transform: uppercase; text-transform: uppercase;
font-weight: normal; font-weight: normal;
} }
tr {
border-bottom: 1px solid var(--seperator);
}
.folder { .folder {
padding-bottom: 1em; padding-bottom: 1em;

View File

@ -1,5 +1,85 @@
const songs = [ const songs = [
{ {
title: "Loved by the best and if you don't fkn fsfsd",
album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
}, {
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
}, {
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
}, {
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
},
{
title: "Loved by the best",
album: "Love songs",
artists: ["Don Williams"],
duration: "03:14",
}, {
title: "Loved by the best", title: "Loved by the best",
album: "Love songs", album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"], artists: ["Don Williams,", "Kenny Rogers"],

View File

@ -31,19 +31,24 @@ export default {
<style> <style>
#f-view-parent { #f-view-parent {
height: 99%; position: relative;
background-color: rgba(0, 0, 0, 0.24); height: 100%;
padding-left: 20px; background-color: rgba(41, 37, 37, 0.301);
padding-right: 20px; padding-left: 1em;
padding-top: 1em; padding-right: 1em;
padding-top: 5em;
} }
#f-view-parent .fixed { #f-view-parent .fixed {
position: absolute;
height: min-content; height: min-content;
width: calc(100% - 2em);
top: .5em;
} }
#scrollable { #scrollable {
overflow-y: auto; overflow-y: scroll;
height: 90%; height: calc(100% - 5em);
margin-bottom: 2em; padding-right: 1em;
} }
</style> </style>