-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optimize frontend for mobile device
- Loading branch information
1 parent
baf0166
commit b0505b4
Showing
6 changed files
with
199 additions
and
126 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { memo } from "react"; | ||
|
||
import { styled } from "@mui/material/styles"; | ||
import ListItem from "@mui/material/ListItem"; | ||
import ListItemText from "@mui/material/ListItemText"; | ||
import ListItemButton from "@mui/material/ListItemButton"; | ||
|
||
import { CopyStatus, SourceState } from "../entity"; | ||
import { formatFilesize } from "../tools"; | ||
|
||
const FileListItemText = styled(ListItemText)({ padding: 0, margin: 5, marginLeft: 10 }); | ||
const FileListItemButton = styled(ListItemButton)({ padding: 0 }); | ||
|
||
export interface FileState { | ||
path: string; | ||
status: CopyStatus; | ||
size: bigint; | ||
// message?: string; | ||
} | ||
|
||
export const FileListItem = memo(({ src, onClick, className }: { src?: FileState; onClick?: () => void; className?: string }) => { | ||
if (!src) { | ||
return null; | ||
} | ||
|
||
const text = <FileListItemText primary={src.path} secondary={`Size: ${formatFilesize(src.size)} Status: ${CopyStatus[src.status]}`} />; | ||
if (!onClick) { | ||
return ( | ||
<ListItem component="div" className={className} disablePadding> | ||
{text} | ||
</ListItem> | ||
); | ||
} | ||
|
||
return ( | ||
<ListItem component="div" className={className} disablePadding> | ||
<FileListItemButton onClick={onClick}>{text}</FileListItemButton> | ||
</ListItem> | ||
); | ||
}); |
Oops, something went wrong.