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
+12 -12
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);
}
+2 -2
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>
+33 -17
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;