-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add path and icon into properties dialog
- Loading branch information
1 parent
be0fbb7
commit 038569f
Showing
7 changed files
with
82 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { useState, useEffect } from "react"; | ||
|
||
import Utils from "../../Utils"; | ||
import Emitter from "../utils/emitter"; | ||
import { DirectoryItem, PropertiesProps } from "../types"; | ||
|
||
import FileIcon from "../../icons/file.svg"; | ||
import FolderIcon from "../../icons/folder_rate.svg"; | ||
|
||
const Properties: React.FC<PropertiesProps> = (props) => { | ||
const [content, setContent] = useState<DirectoryItem | null>(null); | ||
|
||
useEffect(() => { | ||
Emitter.get().on("openProperties", (info: DirectoryItem) => { | ||
setContent(info); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<div className="properties-dialog"> | ||
<ul> | ||
<li> | ||
<b>{Utils.$("page.explorer.list.properties.name")}:</b> | ||
<span>{content?.fullName}</span> | ||
</li> | ||
<li> | ||
<b>{Utils.$("page.explorer.list.properties.format")}:</b> | ||
<span> | ||
{ | ||
content?.isFile | ||
? content.format +" "+ Utils.$("page.explorer.list.file") | ||
: Utils.$("page.explorer.list.folder") | ||
} | ||
</span> | ||
</li> | ||
<li> | ||
<b>{Utils.$("page.explorer.list.properties.path")}:</b> | ||
<span>{props.path +"/"+ content?.fullName}</span> | ||
</li> | ||
{ | ||
content?.isFile && content.size | ||
? <li> | ||
<b>{Utils.$("page.explorer.list.properties.size")}:</b> | ||
<span>{Utils.formatFloat(content.size / 1024, 1) +"KB"}</span> | ||
</li> | ||
: null | ||
} | ||
</ul> | ||
<div className="properties-icon"> | ||
<img src={content?.isFile ? FileIcon : FolderIcon} alt=""/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Properties; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
038569f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://ferrum-demo.nin.red as production
🚀 Deployed on https://635e3aeb5b1bfe16b5529711--resonant-kitsune-43a162.netlify.app