From e037407a5c8f00e85bf61666fb66212088f6a721 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Mon, 24 Mar 2025 21:24:35 +0100 Subject: [PATCH] Introduce styled component for StackedSpan, apply changes to both parts of condition --- .../src/repos/diff/DiffFileTree.tsx | 98 ++++--------------- 1 file changed, 18 insertions(+), 80 deletions(-) diff --git a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx index 8a931fe198..e3a64a3844 100644 --- a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx +++ b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx @@ -27,8 +27,11 @@ type Props = { tree: FileTree; currentFile: string; setCurrentFile: (path: strin const StyledIcon = styled(Icon)` min-width: 1.5rem; `; -const StyledStatus = styled(StyledIcon)` - margin-left: auto; + +const StackedSpan = styled.span` + width: 3em; + height: 3em; + font-size: 0.5em; `; const DiffFileTree: FC = ({ tree, currentFile, setCurrentFile }) => { @@ -94,75 +97,6 @@ const TreeNode: FC = ({ node, parentPath, currentFile, setCurrentFile ); }; -type FileChangeTypeIconProps = { - changeType: string; -}; - -const FileChangeTypeIcon: FC = ({ changeType }) => { - const [t] = useTranslation("repos"); - if (changeType === "ADD") { - return ( - - plus - - ); - } - if (changeType === "MODIFY") { - return ( - - circle - - ); - } - if (changeType === "DELETE") { - return ( - - minus - - ); - } - if (changeType === "RENAME") { - return ( - - circle - - ); - } - if (changeType === "COPY") { - return ( - - plus - - ); - } - return null; -}; - type ChangeType = "add" | "modify" | "delete" | "rename" | "copy"; const getColor = (changeType: ChangeType) => { @@ -213,21 +147,25 @@ const TreeFile: FC = ({ changeType, path, parentPath, currentFile, se return ( setCurrentFile(completePath)}> {isCurrentFile() ? ( - + file - - - - + + {getIcon(changeType)} + + ) : ( - + = ({ changeType, path, parentPath, currentFile, se > {getIcon(changeType)} - + )}
{path}