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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,85 @@
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",
album: "Love songs",
artists: ["Don Williams,", "Kenny Rogers"],

View File

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