Style: Add file/folder icon in file tree (#149)

This commit is contained in:
Lin, Hung-Shin authored and GitHub committed 2024-07-28 12:22:59 +08:00
commit 6400aa4a56
3 files changed
+57 -47

No files matched your search

+15 -1
View File
@@ -20,7 +20,21 @@ function nodeClass() {
</script> </script>
<template> <template>
<a href="#" :class="nodeClass()">{{ node.discovered ? node.name : '???' }}</a> <a href="#" :class="nodeClass()">
<font-awesome-icon
v-if="node.type === 'folder'"
:icon="['far', 'folder']"
class="text-text-primary size-8"
/>
<font-awesome-icon
v-else
:icon="['far', 'file']"
class="text-text-primary size-8"
/>
<br />
{{ node.discovered ? node.name : '???' }}
{{ node.name === '' && node.discovered ? '/' : '' }}
</a>
<ul :class="nodeClass()" v-if="node.children && node.children.length > 0"> <ul :class="nodeClass()" v-if="node.children && node.children.length > 0">
<li :class="nodeClass()" v-for="child in node.children" :key="child.path"> <li :class="nodeClass()" v-for="child in node.children" :key="child.path">
<FileNode :node="child" :pwd="pwd" /> <FileNode :node="child" :pwd="pwd" />
+10 -18
View File
@@ -48,14 +48,14 @@ const sessionStore = useSession()
position: absolute; position: absolute;
top: 0; top: 0;
right: 50%; right: 50%;
border-top: 1px solid #00ff00; border-top: 2px solid #00ff00;
width: 50%; width: 50%;
height: 20px; height: 20px;
} }
.tree li::after { .tree li::after {
right: auto; right: auto;
left: 50%; left: 50%;
border-left: 1px solid #00ff00; border-left: 2px solid #00ff00;
} }
.tree li:only-child::after, .tree li:only-child::after,
@@ -73,7 +73,7 @@ const sessionStore = useSession()
} }
.tree li:last-child::before { .tree li:last-child::before {
border-right: 1px solid #00ff00; border-right: 2px solid #00ff00;
border-radius: 0 5px 0 0; border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0; -webkit-border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0; -moz-border-radius: 0 5px 0 0;
@@ -89,7 +89,7 @@ const sessionStore = useSession()
position: absolute; position: absolute;
top: 0; top: 0;
left: 50%; left: 50%;
border-left: 1px solid #00ff00; border-left: 2px solid #00ff00;
width: 0; width: 0;
height: 20px; height: 20px;
} }
@@ -100,7 +100,7 @@ const sessionStore = useSession()
text-decoration: none; text-decoration: none;
color: #ffffff; color: #ffffff;
font-family: arial, verdana, tahoma; font-family: arial, verdana, tahoma;
font-size: 11px; font-size: 12px;
display: inline-block; display: inline-block;
border-radius: 5px; border-radius: 5px;
@@ -112,18 +112,10 @@ const sessionStore = useSession()
-moz-transition: all 0.5s; -moz-transition: all 0.5s;
} }
a.discovered { .tree li a.pwd {
background: #526b4e; border: 3px solid #00ff00;
color: #000; background: #008080;
border: 1px solid #94a0b4; font-weight: bold;
} font-size: 13px;
ul.discovered,
li.discovered {
border-color: #94a0b4;
}
a.pwd {
box-shadow: 0 0 40px rgba(255, 255, 0, 20);
} }
</style> </style>
+32 -28
View File
@@ -3,28 +3,30 @@ import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */ /* import specific icons */
import { import {
faBars,
faArrowLeft, faArrowLeft,
faList,
faGear,
faTriangleExclamation,
faExpand,
faTerminal,
faArrowRotateLeft,
faArrowRightFromBracket,
faArrowRight, faArrowRight,
faArrowRightFromBracket,
faArrowRotateLeft,
faBars,
faBug, faBug,
faCircleExclamation, faCircleExclamation,
faMap,
faTrophy,
faFileInvoice,
faEnvelope, faEnvelope,
faExpand,
faFileInvoice,
faGear,
faList,
faMap,
faPlay, faPlay,
faTerminal,
faTriangleExclamation,
faTrophy,
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { import {
faLightbulb,
faCircleQuestion, faCircleQuestion,
faCircleRight, faCircleRight,
faFile,
faFolder,
faLightbulb,
} from '@fortawesome/free-regular-svg-icons' } from '@fortawesome/free-regular-svg-icons'
import { import {
faFacebook, faFacebook,
@@ -34,27 +36,29 @@ import {
/* add icons to the library */ /* add icons to the library */
library.add( library.add(
faBars,
faArrowLeft, faArrowLeft,
faList,
faGear,
faTriangleExclamation,
faExpand,
faTerminal,
faArrowRotateLeft,
faArrowRightFromBracket,
faArrowRight, faArrowRight,
faArrowRightFromBracket,
faArrowRotateLeft,
faBars,
faBug, faBug,
faMap,
faTrophy,
faCircleExclamation, faCircleExclamation,
faLightbulb, faEnvelope,
faExpand,
faFileInvoice,
faGear,
faList,
faMap,
faPlay,
faTerminal,
faTriangleExclamation,
faTrophy,
faCircleQuestion, faCircleQuestion,
faCircleRight, faCircleRight,
faGithub, faFile,
faGoogle, faFolder,
faFileInvoice, faLightbulb,
faFacebook, faFacebook,
faEnvelope, faGithub,
faPlay faGoogle
) )