UNPKG

@jupyterlab/git

Version:

A JupyterLab extension for version control using git

18 lines (17 loc) 926 B
import { fileIcon } from '@jupyterlab/ui-components'; import * as React from 'react'; import { fileIconStyle, fileLabelStyle, folderLabelStyle } from '../style/FilePathStyle'; import { extractFilename } from '../utils'; export const FilePath = (props) => { var _a; const filename = extractFilename(props.filepath); const folder = props.filepath .slice(0, props.filepath.length - filename.length) .replace(/^\/|\/$/g, ''); // Remove leading and trailing '/' const icon = ((_a = props.filetype) === null || _a === void 0 ? void 0 : _a.icon) || fileIcon; return (React.createElement(React.Fragment, null, React.createElement(icon.react, { className: fileIconStyle, elementPosition: "center", tag: "span" }), React.createElement("span", { className: fileLabelStyle }, filename, React.createElement("span", { className: folderLabelStyle }, folder)))); };