Skip to content

Commit f71f3e4

Browse files
committed
style: align copy buttons across folder and file rows; refs #88
1 parent 14b17ba commit f71f3e4

File tree

1 file changed

+3
-61
lines changed

1 file changed

+3
-61
lines changed

src/components/DatasetDetailPage/FileTree/FileTreeRow.tsx

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import type { TreeNode } from "./types";
33
import { formatLeafValue, isPreviewable } from "./utils";
44
import CheckIcon from "@mui/icons-material/Check";
5-
// for copy button
6-
// add to imports
75
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
86
import DownloadIcon from "@mui/icons-material/Download";
97
import ExpandLess from "@mui/icons-material/ExpandLess";
@@ -70,41 +68,6 @@ const FileTreeRow: React.FC<Props> = ({
7068
}
7169
};
7270

73-
// if (node.kind === "folder") {
74-
// return (
75-
// <>
76-
// <Box
77-
// sx={{
78-
// display: "flex",
79-
// alignItems: "center",
80-
// gap: 1,
81-
// py: 0.5,
82-
// px: 1,
83-
// cursor: "pointer",
84-
// "&:hover": { backgroundColor: "rgba(0,0,0,0.04)" },
85-
// }}
86-
// onClick={() => setOpen((o) => !o)}
87-
// >
88-
// <Box sx={{ pl: level * 1.25 }}>
89-
// <FolderIcon fontSize="small" />
90-
// </Box>
91-
// <Typography sx={{ fontWeight: 600, flex: 1 }}>{node.name}</Typography>
92-
// {open ? <ExpandLess /> : <ExpandMore />}
93-
// </Box>
94-
95-
// <Collapse in={open} timeout="auto" unmountOnExit>
96-
// {node.children.map((child) => (
97-
// <FileTreeRow
98-
// key={child.path}
99-
// node={child}
100-
// level={level + 1}
101-
// onPreview={onPreview}
102-
// />
103-
// ))}
104-
// </Collapse>
105-
// </>
106-
// );
107-
// }
10871
if (node.kind === "folder") {
10972
// const isSubject = /^sub-/i.test(node.name); // subject folders only
11073
const isJson = /\.json$/i.test(node.name); // end with .json only
@@ -225,9 +188,7 @@ const FileTreeRow: React.FC<Props> = ({
225188
}
226189
// if the node is a file
227190
return (
228-
<Box
229-
sx={{ display: "flex", alignItems: "flex-start", gap: 1, py: 0.5, px: 1 }}
230-
>
191+
<Box sx={{ display: "flex", alignItems: "center", gap: 1, py: 0.5, px: 1 }}>
231192
<Box sx={{ pl: level * 1.25, pt: "2px" }}>
232193
<InsertDriveFileIcon
233194
fontSize="small"
@@ -289,6 +250,8 @@ const FileTreeRow: React.FC<Props> = ({
289250
</IconButton>
290251
</span>
291252
</Tooltip>
253+
{/* Placeholder to align with folder chevron */}
254+
<Box sx={{ width: 28 }} />
292255
{(externalUrl || internal) && (
293256
<Box
294257
sx={{ display: "flex", gap: 1, flexShrink: 0 }}
@@ -331,27 +294,6 @@ const FileTreeRow: React.FC<Props> = ({
331294
Preview
332295
</Button>
333296
)}
334-
335-
{/* {node.link?.url && (
336-
<Box sx={{ display: "flex", gap: 1, flexShrink: 0 }}>
337-
<Button
338-
size="small"
339-
variant="text"
340-
onClick={() => window.open(node.link!.url, "_blank")}
341-
startIcon={<DownloadIcon fontSize="small" />}
342-
>
343-
Download
344-
</Button>
345-
{isPreviewable(node.link.url) && (
346-
<Button
347-
size="small"
348-
variant="text"
349-
startIcon={<VisibilityIcon fontSize="small" />}
350-
onClick={() => onPreview(node.link!.url, node.link!.index)}
351-
>
352-
Preview
353-
</Button>
354-
)} */}
355297
</Box>
356298
)}
357299
</Box>

0 commit comments

Comments
 (0)