Added image previews for file explorer
This commit is contained in:
parent
b2c5f33462
commit
16ea58702e
5 changed files with 20 additions and 10 deletions
|
|
@ -16,7 +16,9 @@ function FilePreview({ file }) {
|
||||||
|
|
||||||
switch (file.extension) {
|
switch (file.extension) {
|
||||||
case "png":
|
case "png":
|
||||||
preview = <FontAwesomeIcon icon={faImage}/>
|
preview = (<div className={styles["File-button-preview"]}>
|
||||||
|
<img src={file.source} alt={file.id}/>
|
||||||
|
</div>)
|
||||||
break;
|
break;
|
||||||
case "txt":
|
case "txt":
|
||||||
preview = <FontAwesomeIcon icon={faFileLines}/>
|
preview = <FontAwesomeIcon icon={faFileLines}/>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
.Container {
|
.Container {
|
||||||
--header-height: 3.5rem;
|
--header-height: 3.5rem;
|
||||||
--sidebar-width: 10rem;
|
--sidebar-width: 10rem;
|
||||||
--scale: 1rem;
|
--scale: 1.15rem;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
@ -141,6 +141,17 @@
|
||||||
background-color: rgba(255, 255, 255, 10%);
|
background-color: rgba(255, 255, 255, 10%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.File-button-preview {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.File-button-preview > * {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
.File-button svg, .Folder-button svg {
|
.File-button svg, .Folder-button svg {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ export function HomeMenu({ active, setActive }) {
|
||||||
|
|
||||||
let onlyAltKey = false;
|
let onlyAltKey = false;
|
||||||
const onKeyDown = (event) => {
|
const onKeyDown = (event) => {
|
||||||
console.log(event);
|
|
||||||
|
|
||||||
if (event.key === "Alt") {
|
if (event.key === "Alt") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onlyAltKey = true;
|
onlyAltKey = true;
|
||||||
|
|
@ -27,8 +25,6 @@ export function HomeMenu({ active, setActive }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyUp = (event) => {
|
const onKeyUp = (event) => {
|
||||||
console.log(event);
|
|
||||||
|
|
||||||
if (event.key === "Alt" && onlyAltKey) {
|
if (event.key === "Alt" && onlyAltKey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setActive(!active);
|
setActive(!active);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
.Container-inner {
|
.Container-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 16rem;
|
min-width: 16rem;
|
||||||
|
max-width: 32rem;
|
||||||
border-top-left-radius: 0.5rem;
|
border-top-left-radius: 0.5rem;
|
||||||
border-top-right-radius: 0.5rem;
|
border-top-right-radius: 0.5rem;
|
||||||
border-bottom-right-radius: 0.5rem;
|
border-bottom-right-radius: 0.5rem;
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,13 @@ function initVirtualRoot(virtualRoot) {
|
||||||
folder.createFolder("prozilla-os", (folder) => {
|
folder.createFolder("prozilla-os", (folder) => {
|
||||||
folder.setAlias("~")
|
folder.setAlias("~")
|
||||||
.createFolder("Images", (folder) => {
|
.createFolder("Images", (folder) => {
|
||||||
folder.createFile("Wallpaper_1", "png", (file) => {
|
folder.createFile("Wallpaper1", "png", (file) => {
|
||||||
file.setSource("/media/wallpapers/wallpaper1.png")
|
file.setSource("/media/wallpapers/wallpaper1.png")
|
||||||
}).createFile("Wallpaper_2", "png", (file) => {
|
}).createFile("Wallpaper2", "png", (file) => {
|
||||||
file.setSource("/media/wallpapers/wallpaper2.png")
|
file.setSource("/media/wallpapers/wallpaper2.png")
|
||||||
}).createFile("Wallpaper_3", "png", (file) => {
|
}).createFile("Wallpaper3", "png", (file) => {
|
||||||
file.setSource("/media/wallpapers/wallpaper3.png")
|
file.setSource("/media/wallpapers/wallpaper3.png")
|
||||||
}).createFile("Wallpaper_4", "png", (file) => {
|
}).createFile("Wallpaper4", "png", (file) => {
|
||||||
file.setSource("/media/wallpapers/wallpaper4.png")
|
file.setSource("/media/wallpapers/wallpaper4.png")
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue