file-tree.scss 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. :root {
  2. --file-tree-item-hover-bg: var(--bg-dark-secondary);
  3. --file-tree-item-selected-bg: var(--bg-accent-01);
  4. --file-tree-item-color: var(--content-primary-dark);
  5. --file-tree-bg: var(--bg-dark-tertiary);
  6. --file-tree-item-selected-color: var(--content-primary-dark);
  7. --file-tree-item-dragging-bg: #{rgb($bg-dark-secondary, 0.9)};
  8. --file-tree-item-dragging-color: var(--content-primary-dark);
  9. --file-tree-item-dragging-preview-bg: #{rgb($bg-accent-01, 0.6)};
  10. --file-tree-item-dragging-preview-colour: var(--content-primary-dark);
  11. --file-tree-line-height: 2.05;
  12. --file-tree-icon-colour: var(--content-disabled);
  13. }
  14. @include theme('light') {
  15. --file-tree-item-hover-bg: var(--bg-light-tertiary);
  16. --file-tree-item-color: var(--content-secondary);
  17. --file-tree-bg: var(--bg-light-primary);
  18. --file-tree-item-selected-color: var(--bg-light-primary);
  19. --file-tree-item-dragging-bg: #{rgb($bg-light-tertiary, 0.9)};
  20. --file-tree-item-dragging-color: var(--content-secondary);
  21. --file-tree-item-dragging-preview-colour: var(--bg-light-primary);
  22. }
  23. // TODO ide-redesign-cleanup: Replace the existing styling with these overrides.
  24. .ide-redesign-main {
  25. --file-tree-item-hover-bg: var(--bg-light-secondary);
  26. --file-tree-item-selected-bg: var(--bg-dark-primary);
  27. --file-tree-item-selected-color: var(--white);
  28. --file-tree-item-color: var(--content-primary);
  29. --file-tree-bg: var(--white);
  30. --file-tree-icon-colour: var(--content-primary);
  31. --file-tree-item-dragging-bg: #{rgb($bg-dark-primary, 0.9)};
  32. --file-tree-item-dragging-color: var(--white);
  33. --file-tree-item-dragging-preview-bg: #{rgb($bg-light-secondary, 0.6)};
  34. --file-tree-item-dragging-preview-colour: #{rgb($content-primary, 0.6)};
  35. .file-tree {
  36. background-color: var(--file-tree-bg);
  37. }
  38. .file-tree ul.file-tree-list {
  39. margin: var(--spacing-02);
  40. }
  41. .file-tree-folder-list {
  42. border-left: 1px solid
  43. color-mix(in srgb, var(--border-primary) 24%, transparent);
  44. margin-left: 14px !important;
  45. &.file-tree-list {
  46. border-left: none;
  47. margin-left: var(--spacing-02) !important;
  48. > .file-tree-folder-list-inner {
  49. margin-left: 0;
  50. }
  51. }
  52. }
  53. .file-tree-folder-list-inner {
  54. margin-left: 10px;
  55. display: flex;
  56. flex-direction: column;
  57. gap: var(--spacing-02);
  58. }
  59. .item-name-button,
  60. .folder-expand-collapse-button {
  61. display: flex;
  62. align-items: center;
  63. height: 20px !important;
  64. }
  65. .file-tree ul.file-tree-list li .material-symbols.file-tree-expand-icon {
  66. margin-left: 0;
  67. }
  68. .file-tree ul.file-tree-list li .material-symbols.file-tree-icon {
  69. margin-left: 0;
  70. margin-right: 0;
  71. }
  72. // TODO ide-redesign-cleanup: Remove the !important overrides once
  73. // we have replaced the default styling
  74. .linked-file-highlight {
  75. background-color: var(--file-tree-bg) !important;
  76. color: var(--file-tree-icon-colour) !important;
  77. left: 14px !important;
  78. }
  79. .entity-name {
  80. color: var(--file-tree-item-color);
  81. border-radius: var(--border-radius-base);
  82. padding: var(--spacing-02);
  83. // TODO ide-redesign-cleanup: This is here to override the fake-full-width-bg
  84. // mixin. We can just remove that mixin when we clean this up.
  85. &::before {
  86. content: none !important;
  87. }
  88. }
  89. .item-name-button {
  90. margin-left: var(--spacing-02);
  91. }
  92. .dnd-draggable-preview-item {
  93. border-radius: var(--border-radius-base);
  94. }
  95. }
  96. .ide-react-file-tree-panel {
  97. display: flex;
  98. flex-direction: column;
  99. // Prevent the file tree expanding beyond the boundary of the panel
  100. .file-tree {
  101. width: 100%;
  102. }
  103. }
  104. .context-menu {
  105. position: fixed;
  106. z-index: 100;
  107. }
  108. .editor-sidebar {
  109. background-color: var(--file-tree-bg);
  110. display: flex;
  111. flex-direction: column;
  112. }
  113. @mixin fake-full-width-bg($bg-color) {
  114. &::before {
  115. content: '\00a0';
  116. position: absolute;
  117. width: 9999px;
  118. left: -9999px;
  119. background-color: $bg-color;
  120. }
  121. }
  122. @include theme('default') {
  123. .file-tree {
  124. .toolbar {
  125. .toolbar-right,
  126. .toolbar-left {
  127. button {
  128. opacity: 0.8;
  129. &:hover,
  130. &:focus,
  131. &:active,
  132. &.active {
  133. background-color: rgba(125 125 125 / 20%);
  134. }
  135. &.active,
  136. &:active {
  137. background-color: rgba(125 125 125 / 40%);
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. .file-tree {
  145. display: flex !important; // To work around jQuery layout's inline styles
  146. flex-direction: column;
  147. height: 100%;
  148. .file-tree-inner {
  149. position: relative;
  150. display: flex;
  151. flex-direction: column;
  152. flex-grow: 1;
  153. overflow-y: auto;
  154. width: inherit;
  155. height: inherit;
  156. font-size: var(--font-size-02);
  157. &.no-toolbar {
  158. top: 0;
  159. }
  160. }
  161. // TODO; Consolidate with "Project files" in Overleaf
  162. h3 {
  163. font-size: var(--font-size-03);
  164. border-bottom: 1px solid var(--border-primary);
  165. padding-bottom: var(--spacing-02);
  166. margin: var(--spacing-05);
  167. }
  168. .toolbar {
  169. .toolbar-right,
  170. .toolbar-left {
  171. button {
  172. display: inline-flex;
  173. align-items: center;
  174. justify-content: center;
  175. width: 24px;
  176. height: 24px;
  177. padding: 0;
  178. box-shadow: none;
  179. border-radius: var(--border-radius-base);
  180. border: none;
  181. &:hover,
  182. &:focus,
  183. &:active,
  184. &.active {
  185. background-color: rgb(125 125 125 / 10%);
  186. color: var(--toolbar-btn-color) !important;
  187. }
  188. &.active,
  189. &:active {
  190. background-color: rgb(125 125 125 / 20%);
  191. }
  192. }
  193. }
  194. }
  195. ul.file-tree-list {
  196. margin: 0;
  197. overflow: hidden auto;
  198. height: 100%;
  199. flex-grow: 1;
  200. position: relative;
  201. .entity > ul,
  202. ul[role='tree'] {
  203. margin-left: var(--spacing-08);
  204. }
  205. &::after {
  206. content: '';
  207. display: block;
  208. min-height: var(--spacing-08);
  209. }
  210. li {
  211. line-height: var(--file-tree-line-height);
  212. position: relative;
  213. .entity {
  214. user-select: none;
  215. }
  216. .entity > .entity-name {
  217. display: flex;
  218. align-items: center;
  219. & > button {
  220. background-color: transparent;
  221. border: 0;
  222. padding: 0;
  223. &.item-name-button {
  224. color: inherit;
  225. width: 100%;
  226. overflow: hidden;
  227. text-overflow: ellipsis;
  228. text-align: left;
  229. padding-right: var(--spacing-09);
  230. white-space: pre;
  231. }
  232. }
  233. }
  234. .entity-name {
  235. color: var(--file-tree-item-color);
  236. cursor: pointer;
  237. white-space: nowrap;
  238. overflow: hidden;
  239. text-overflow: ellipsis;
  240. &.entity-name-react {
  241. text-overflow: clip;
  242. }
  243. background-color: transparent;
  244. @include fake-full-width-bg(transparent);
  245. &:hover {
  246. background-color: var(--file-tree-item-hover-bg);
  247. // When the entity is a subfolder, the DOM element is "indented" via margin-left. This makes the
  248. // element not fill the entire file-tree width (as it's spaced from the left-hand side via margin)
  249. // and, in consequence, the background gets clipped. The ::before pseudo-selector is used to fill
  250. // the empty space.
  251. @include fake-full-width-bg(var(--file-tree-item-hover-bg));
  252. }
  253. input {
  254. line-height: 1.6;
  255. }
  256. .entity-menu-toggle > .material-symbols {
  257. color: var(--content-primary-dark);
  258. vertical-align: middle;
  259. }
  260. }
  261. .material-symbols {
  262. color: var(--file-tree-icon-colour);
  263. &.file-tree-icon {
  264. margin-right: var(--spacing-02);
  265. margin-left: var(--spacing-04);
  266. vertical-align: sub;
  267. &.linked-file-icon {
  268. position: relative;
  269. left: -2px;
  270. + .linked-file-highlight {
  271. color: var(--file-tree-bg);
  272. background-color: var(--content-disabled);
  273. position: absolute;
  274. top: 14px;
  275. left: 20px;
  276. font-size: var(--font-size-01);
  277. border-radius: var(--spacing-01);
  278. }
  279. }
  280. }
  281. &.file-tree-folder-icon {
  282. margin-right: var(--spacing-02);
  283. vertical-align: sub;
  284. }
  285. &.file-tree-expand-icon {
  286. margin-left: var(--spacing-04);
  287. vertical-align: sub;
  288. }
  289. }
  290. .material-symbols.toggle {
  291. width: 24px;
  292. padding: var(--spacing-03);
  293. font-size: var(--font-size-03);
  294. color: var(--file-tree-icon-colour);
  295. }
  296. .file-tree-dropdown-toggle {
  297. display: flex;
  298. align-items: center;
  299. color: var(--content-primary-dark);
  300. line-height: 1.6;
  301. font-size: var(--font-size-05);
  302. padding: 0 var(--font-size-02) 0 var(--font-size-04);
  303. &:hover,
  304. &:focus {
  305. text-decoration: none;
  306. }
  307. &::before {
  308. content: '\00B7\00B7\00B7';
  309. transform: rotate(90deg);
  310. letter-spacing: 0.5px;
  311. }
  312. }
  313. &.multi-selected {
  314. > .entity {
  315. > .entity-name {
  316. > div > .material-symbols,
  317. > button > .material-symbols,
  318. > .material-symbols,
  319. .entity-menu-toggle .material-symbols {
  320. color: var(--content-primary-dark);
  321. }
  322. > .material-symbols.linked-file-highlight {
  323. background-color: var(--bg-info-01);
  324. }
  325. @include fake-full-width-bg(var(--bg-info-01));
  326. color: var(--content-primary-dark);
  327. font-weight: bold;
  328. background-color: var(--bg-info-01);
  329. &:hover {
  330. background-color: var(--bg-info-02);
  331. @include fake-full-width-bg(var(--bg-info-02));
  332. }
  333. }
  334. }
  335. }
  336. .menu-button {
  337. position: absolute;
  338. right: 0;
  339. }
  340. .rename-input {
  341. display: block;
  342. position: absolute;
  343. top: 1px;
  344. left: 32px;
  345. right: 32px;
  346. color: var(--content-primary);
  347. input {
  348. width: 100%;
  349. }
  350. }
  351. > .entity > .entity-name {
  352. .entity-menu-toggle {
  353. display: none;
  354. }
  355. }
  356. .entity-limit-hit {
  357. line-height: var(--file-tree-line-height);
  358. color: var(--file-tree-item-color);
  359. margin-left: var(--spacing-05);
  360. white-space: nowrap;
  361. overflow: hidden;
  362. text-overflow: ellipsis;
  363. }
  364. .entity-limit-hit-message {
  365. font-style: italic;
  366. }
  367. .material-symbols .entity-limit-hit-tooltip-trigger {
  368. margin-left: var(spacing-03);
  369. cursor: pointer;
  370. }
  371. }
  372. }
  373. &:not(.multi-selected) {
  374. ul.file-tree-list li.selected {
  375. > .entity {
  376. > .entity-name {
  377. background-color: var(--file-tree-item-selected-bg);
  378. color: var(--file-tree-item-selected-color);
  379. > div > .material-symbols,
  380. > button > .material-symbols,
  381. > .material-symbols,
  382. .entity-menu-toggle .material-symbols {
  383. color: var(--file-tree-item-selected-color);
  384. }
  385. > .material-symbols.linked-file-highlight {
  386. background-color: var(--bg-info-01);
  387. }
  388. @include fake-full-width-bg(var(--file-tree-item-selected-bg));
  389. font-weight: bold;
  390. padding-right: var(--spacing-09);
  391. button {
  392. font-weight: inherit;
  393. }
  394. .entity-menu-toggle {
  395. display: inline-block;
  396. background-color: transparent;
  397. box-shadow: none;
  398. border: 0;
  399. padding-right: var(--spacing-02);
  400. padding-left: var(--spacing-02);
  401. }
  402. }
  403. }
  404. }
  405. }
  406. // while dragging, the previously selected item gets no highlight
  407. ul.file-tree-list.file-tree-dragging li.selected .entity .entity-name {
  408. @include fake-full-width-bg(transparent);
  409. font-weight: normal;
  410. background-color: transparent;
  411. color: var(--file-tree-item-color);
  412. .material-symbols {
  413. color: var(--content-disabled) !important;
  414. }
  415. }
  416. // the items being dragged get the full "hover" colour
  417. ul.file-tree-list.file-tree-dragging
  418. li
  419. .entity.file-tree-entity-dragging
  420. .entity-name {
  421. background-color: var(--file-tree-item-dragging-bg);
  422. @include fake-full-width-bg(var(--file-tree-item-dragging-bg));
  423. color: var(--file-tree-item-dragging-color);
  424. .material-symbols {
  425. color: var(--content-disabled) !important;
  426. }
  427. }
  428. // the drop target gets the "selected" colour
  429. ul.file-tree-list.file-tree-dragging
  430. li.dnd-droppable-hover
  431. .entity
  432. .entity-name {
  433. background-color: var(--file-tree-item-selected-bg);
  434. @include fake-full-width-bg(var(--file-tree-item-selected-bg));
  435. color: var(--file-tree-item-selected-color);
  436. .material-symbols {
  437. color: var(--file-tree-item-selected-color) !important;
  438. }
  439. }
  440. .dnd-draggable-preview-layer {
  441. position: absolute;
  442. pointer-events: none;
  443. z-index: 100;
  444. width: 100%;
  445. height: 100%;
  446. overflow: hidden;
  447. &.dnd-droppable-hover {
  448. border: 3px solid var(--file-tree-item-selected-bg);
  449. }
  450. }
  451. .dnd-draggable-preview-item {
  452. color: var(--file-tree-item-dragging-preview-colour);
  453. background-color: var(--file-tree-item-dragging-preview-bg);
  454. width: 75%;
  455. padding-left: var(--spacing-08);
  456. line-height: 2.05;
  457. overflow: hidden;
  458. text-overflow: ellipsis;
  459. white-space: nowrap;
  460. }
  461. .disconnected-overlay {
  462. background-color: var(--file-tree-bg);
  463. position: absolute;
  464. top: 0;
  465. left: 0;
  466. width: 100%;
  467. height: 100%;
  468. z-index: 10;
  469. opacity: 0.5;
  470. cursor: wait;
  471. }
  472. }
  473. .modal-new-file {
  474. padding: 0;
  475. table {
  476. width: 100%;
  477. table-layout: fixed;
  478. td {
  479. vertical-align: top;
  480. }
  481. }
  482. .toggle-file-type-button {
  483. font-size: var(--font-size-02);
  484. margin-top: calc(var(--spacing-05) * -1);
  485. .btn {
  486. display: inline-block;
  487. padding: 0;
  488. vertical-align: baseline;
  489. font-size: inherit;
  490. }
  491. .btn:focus-within {
  492. outline: none;
  493. text-decoration: none;
  494. }
  495. }
  496. }
  497. .modal-new-file-list {
  498. background-color: var(--bg-light-secondary);
  499. width: 220px;
  500. ul {
  501. li {
  502. /* old modal (a) */
  503. a {
  504. color: var(--content-secondary);
  505. padding: var(--spacing-03);
  506. display: block;
  507. text-decoration: none;
  508. }
  509. /* new modal (button) */
  510. .btn {
  511. color: var(--content-secondary);
  512. padding: var(--spacing-03);
  513. }
  514. .btn:hover {
  515. text-decoration: none;
  516. }
  517. .btn:focus {
  518. outline: none;
  519. text-decoration: none;
  520. background-color: white;
  521. }
  522. }
  523. li.active {
  524. background-color: white;
  525. /* old modal (a) */
  526. a {
  527. color: var(--link-ui);
  528. }
  529. /* new modal (button) */
  530. .btn {
  531. color: var(--link-ui);
  532. text-decoration: none;
  533. }
  534. }
  535. li:hover {
  536. background-color: white;
  537. }
  538. }
  539. }
  540. .file-tree-error {
  541. text-align: center;
  542. color: var(--content-secondary-dark);
  543. padding: 20px;
  544. }
  545. .file-tree-modal-alert {
  546. margin-top: var(--spacing-06);
  547. }
  548. .btn.modal-new-file-mode {
  549. justify-content: left;
  550. text-align: left;
  551. text-decoration: none;
  552. width: 100%;
  553. }
  554. .modal-new-file-body {
  555. padding: 20px;
  556. padding-top: var(--spacing-03);
  557. }
  558. .modal-new-file-body-upload {
  559. padding-top: 20px;
  560. }
  561. .modal-new-file-body-conflict {
  562. background-color: var(--bg-danger-03);
  563. border: 1px dashed var(--border-danger);
  564. min-height: 400px;
  565. border-radius: 3px;
  566. color: var(--content-primary);
  567. display: flex;
  568. flex-direction: column;
  569. justify-content: center;
  570. padding: var(--spacing-05);
  571. }
  572. .modal-footer {
  573. .approaching-file-limit {
  574. font-weight: bold;
  575. }
  576. .at-file-limit {
  577. text-align: left;
  578. }
  579. }
  580. /* stylelint-disable selector-class-pattern */
  581. .modal-new-file-body-upload .uppy-Root {
  582. font-family: inherit;
  583. }
  584. .modal-new-file-body-upload .uppy-Dashboard {
  585. .uppy-Dashboard-inner {
  586. border: none;
  587. }
  588. .uppy-Dashboard-dropFilesHereHint {
  589. inset: 0;
  590. }
  591. .uppy-Dashboard-AddFiles {
  592. margin: 0;
  593. border: 1px dashed var(--border-primary);
  594. height: 100%;
  595. .uppy-Dashboard-AddFiles-title {
  596. font-size: inherit;
  597. }
  598. }
  599. .uppy-Dashboard-AddFiles-title {
  600. width: 26em; // sized to create a wrap between the sentences
  601. max-width: 100%;
  602. }
  603. .uppy-Informer p {
  604. background-color: var(--bg-info-03);
  605. border: 1px solid var(--blue-20);
  606. border-radius: var(--border-radius-base);
  607. color: var(--content-primary);
  608. font-size: var(--font-size-03);
  609. }
  610. }