Просмотр исходного кода

In history react file tree, always show badge (stick to the right side) and truncate long filename with ellipsis (#12897)

GitOrigin-RevId: 2e982f03b7a60e506f061a2c5bf1ab3d93dfccf5
M Fahru 3 лет назад
Родитель
Сommit
c19fa74aa4

+ 6 - 6
services/web/frontend/js/features/history/components/file-tree/history-file-tree-item.tsx

@@ -17,20 +17,20 @@ export default function HistoryFileTreeItem({
   return (
   return (
     <div className="history-file-tree-item" role="presentation">
     <div className="history-file-tree-item" role="presentation">
       {icons}
       {icons}
-      <button className="history-file-tree-item-button">
-        <span
-          className={classNames('history-file-tree-item-button-text', {
+      <div className="history-file-tree-item-name-wrapper">
+        <div
+          className={classNames('history-file-tree-item-name', {
             strikethrough: operation === 'removed',
             strikethrough: operation === 'removed',
           })}
           })}
         >
         >
           {name}
           {name}
-        </span>
+        </div>
         {operation ? (
         {operation ? (
-          <Badge className="history-file-tree-item-button-badge" size="sm">
+          <Badge className="history-file-tree-item-badge" size="sm">
             {operation}
             {operation}
           </Badge>
           </Badge>
         ) : null}
         ) : null}
-      </button>
+      </div>
     </div>
     </div>
   )
   )
 }
 }

+ 19 - 15
services/web/frontend/stylesheets/app/editor/history-react.less

@@ -382,6 +382,7 @@ history-root {
     li {
     li {
       line-height: @file-tree-line-height;
       line-height: @file-tree-line-height;
       position: relative;
       position: relative;
+      margin-left: 8px;
 
 
       &:focus {
       &:focus {
         outline: none;
         outline: none;
@@ -391,9 +392,9 @@ history-root {
         color: @file-tree-item-color;
         color: @file-tree-item-color;
         cursor: pointer;
         cursor: pointer;
         white-space: nowrap;
         white-space: nowrap;
-        overflow: hidden;
-        text-overflow: clip;
         user-select: none;
         user-select: none;
+        display: flex;
+        align-items: center;
 
 
         &:focus {
         &:focus {
           outline: none;
           outline: none;
@@ -418,29 +419,30 @@ history-root {
           }
           }
         }
         }
 
 
-        .history-file-tree-item-button {
+        .history-file-tree-item-name-wrapper {
+          display: flex;
+          align-items: center;
           width: 100%;
           width: 100%;
           overflow: hidden;
           overflow: hidden;
-          text-overflow: ellipsis;
-          text-align: left;
-          padding-right: 40px;
-          font-weight: normal;
-          display: inline-flex;
-          flex-direction: row;
-          align-items: center;
-          justify-content: space-between;
 
 
-          .history-file-tree-item-button-text {
-            display: inline-flex;
-            margin-right: 5px;
+          .history-file-tree-item-name {
+            margin-right: @margin-xs;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            text-align: left;
+            font-weight: normal;
+            flex-grow: 1;
 
 
             &.strikethrough {
             &.strikethrough {
               text-decoration: line-through;
               text-decoration: line-through;
             }
             }
           }
           }
 
 
-          .history-file-tree-item-button-badge {
+          .history-file-tree-item-badge {
             text-transform: capitalize;
             text-transform: capitalize;
+            font-weight: normal;
+            margin-right: @margin-sm;
+            flex-shrink: 0;
 
 
             &:hover {
             &:hover {
               background-color: @neutral-20;
               background-color: @neutral-20;
@@ -452,6 +454,8 @@ history-root {
       i.fa {
       i.fa {
         color: @file-tree-item-icon-color;
         color: @file-tree-item-icon-color;
         font-size: 14px;
         font-size: 14px;
+        display: inline-flex;
+        flex-shrink: 0;
 
 
         &.file-tree-icon {
         &.file-tree-icon {
           margin-right: 4px;
           margin-right: 4px;