Elffuss BraidHub

kikocis/continue public

6c9c9d0b91ee · 1.0 KiBRawPermalink
1import { getLastNPathParts } from "core/util/uri";
2import { MouseEventHandler } from "react";
3import FileIcon from "../../FileIcon";
4import { ToolTip } from "../../gui/Tooltip";
5
6export interface FileInfoProps {
7 filepath: string;
8 onClick?: MouseEventHandler<HTMLDivElement>;
9 range?: string;
10}
11
12export const FileInfo = ({ filepath, range, onClick }: FileInfoProps) => {
13 return (
14 <ToolTip
15 style={{
16 maxWidth: "200px",
17 textAlign: "left",
18 whiteSpace: "normal",
19 wordBreak: "break-word",
20 }}
21 content={filepath}
22 place="top-end"
23 >
24 <div
25 className={`flex select-none flex-row items-center gap-0.5 ${onClick && "cursor-pointer hover:underline"}`}
26 onClick={onClick}
27 >
28 <div>
29 <FileIcon height="20px" width="20px" filename={filepath} />
30 </div>
31 <span className="line-clamp-1 break-all">
32 {getLastNPathParts(filepath, 1)}
33 {range && ` ${range}`}
34 </span>
35 </div>
36 </ToolTip>
37 );
38};