Преглед изворни кода

Improve spacing in file tree (#7736)

GitOrigin-RevId: f1cbc3b3f637d15d56d40693b15f53c53a24792f
Alf Eaton пре 4 година
родитељ
комит
11b3e7b6c8

+ 3 - 1
services/web/frontend/js/features/file-tree/components/file-tree-doc.js

@@ -41,7 +41,9 @@ FileTreeDoc.propTypes = {
 export const FileTreeIcon = ({ isLinkedFile, name }) => {
   const { t } = useTranslation()
 
-  const className = classnames('spaced', { 'linked-file-icon': isLinkedFile })
+  const className = classnames('spaced', 'file-tree-icon', {
+    'linked-file-icon': isLinkedFile,
+  })
 
   return (
     <>

+ 10 - 2
services/web/frontend/js/features/file-tree/components/file-tree-folder.js

@@ -45,9 +45,17 @@ function FileTreeFolder({ name, id, folders, docs, files }) {
         onClick={handleExpandCollapseClick}
         aria-label={expanded ? t('collapse') : t('expand')}
       >
-        <Icon type={expanded ? 'angle-down' : 'angle-right'} fw />
+        <Icon
+          type={expanded ? 'angle-down' : 'angle-right'}
+          fw
+          className="file-tree-expand-icon"
+        />
       </button>
-      <Icon type={expanded ? 'folder-open' : 'folder'} fw />
+      <Icon
+        type={expanded ? 'folder-open' : 'folder'}
+        fw
+        className="file-tree-folder-icon"
+      />
     </>
   )
 

+ 2 - 1
services/web/frontend/js/features/file-tree/components/file-tree-item/file-tree-item-menu.js

@@ -37,7 +37,8 @@ function FileTreeItemMenu({ id }) {
   return (
     <div className="menu-button btn-group">
       <Button
-        className="entity-menu-toggle btn btn-default"
+        className="entity-menu-toggle"
+        bsSize="sm"
         id={`menu-button-${id}`}
         onClick={withoutPropagation(handleClick)}
         ref={menuButtonRef}

+ 29 - 19
services/web/frontend/stylesheets/app/editor/file-tree.less

@@ -93,7 +93,7 @@
 
     .entity > ul,
     ul[role='tree'] {
-      margin-left: (@line-height-computed / 2);
+      margin-left: 22px;
     }
 
     li.bottom-buffer {
@@ -171,21 +171,34 @@
       i.fa {
         color: @file-tree-item-icon-color;
         font-size: 14px;
-      }
-
-      i.fa.linked-file-icon {
-        position: relative;
-        left: -2px;
 
-        + .linked-file-highlight {
-          & {
-            color: white;
+        &.file-tree-icon {
+          margin-right: 4px;
+          margin-left: 8px;
+
+          &.linked-file-icon {
+            position: relative;
+            left: -2px;
+
+            + .linked-file-highlight {
+              & {
+                color: white;
+              }
+              position: relative;
+              top: 4px;
+              width: 0;
+              left: -5px;
+              font-size: 12px;
+            }
           }
-          position: relative;
-          top: 4px;
-          width: 0;
-          left: -2px;
-          font-size: 12px;
+        }
+
+        &.file-tree-folder-icon {
+          margin-right: 4px;
+        }
+
+        &.file-tree-expand-icon {
+          margin-left: 8px;
         }
       }
 
@@ -195,10 +208,6 @@
         font-size: 14px;
       }
 
-      i.spaced {
-        margin-left: 18px;
-      }
-
       i.toggle {
         width: 24px;
         padding: 6px;
@@ -252,13 +261,14 @@
       .menu-button {
         position: absolute;
         right: 0;
+        top: 3px;
       }
 
       .rename-input {
         display: block;
         position: absolute;
         top: 1px;
-        left: 44px;
+        left: 32px;
         right: 32px;
         color: @file-tree-item-input-color;
         input {