From 39b6b8baed24df543da3f683af12647111c318a9 Mon Sep 17 00:00:00 2001
From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com>
Date: Tue, 3 Sep 2024 13:30:25 +0200
Subject: [PATCH] Merge pull request #20172 from overleaf/rd-ide-fileoutline
[web] Migrate the file outline styling from LESS to SCSS
GitOrigin-RevId: 5e485b13a7358e5dcab2c75ee7d36a07e1401e26
---
.../components/outline-item-toggle-button.tsx | 6 +-
.../components/outline-toggle-button.tsx | 20 +-
.../stylesheets/app/editor/ide-react.less | 4 +
.../bootstrap-5/abstracts/mixins.scss | 22 ++
.../stylesheets/bootstrap-5/pages/all.scss | 6 +-
.../bootstrap-5/pages/editor/file-tree.scss | 9 +
.../bootstrap-5/pages/editor/ide.scss | 53 +++++
.../loading-screen.scss} | 6 +-
.../bootstrap-5/pages/editor/outline.scss | 213 ++++++++++++++++++
.../bootstrap-5/pages/editor/toolbar.scss | 8 +
10 files changed, 330 insertions(+), 17 deletions(-)
create mode 100644 services/web/frontend/stylesheets/bootstrap-5/pages/editor/file-tree.scss
create mode 100644 services/web/frontend/stylesheets/bootstrap-5/pages/editor/ide.scss
rename services/web/frontend/stylesheets/bootstrap-5/pages/{editor.scss => editor/loading-screen.scss} (82%)
create mode 100644 services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss
create mode 100644 services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
diff --git a/services/web/frontend/js/features/outline/components/outline-item-toggle-button.tsx b/services/web/frontend/js/features/outline/components/outline-item-toggle-button.tsx
index e2e8ff063a..9f277f101f 100644
--- a/services/web/frontend/js/features/outline/components/outline-item-toggle-button.tsx
+++ b/services/web/frontend/js/features/outline/components/outline-item-toggle-button.tsx
@@ -1,6 +1,6 @@
import { memo, type Dispatch, type SetStateAction } from 'react'
-import Icon from '@/shared/components/icon'
import { useTranslation } from 'react-i18next'
+import MaterialIcon from '@/shared/components/material-icon'
export const OutlineItemToggleButton = memo<{
expanded: boolean
@@ -14,8 +14,8 @@ export const OutlineItemToggleButton = memo<{
onClick={() => setExpanded(value => !value)}
aria-label={expanded ? t('collapse') : t('expand')}
>
-
diff --git a/services/web/frontend/js/features/outline/components/outline-toggle-button.tsx b/services/web/frontend/js/features/outline/components/outline-toggle-button.tsx
index 66f145cc31..2d33b5963f 100644
--- a/services/web/frontend/js/features/outline/components/outline-toggle-button.tsx
+++ b/services/web/frontend/js/features/outline/components/outline-toggle-button.tsx
@@ -1,5 +1,5 @@
-import Icon from '@/shared/components/icon'
-import Tooltip from '@/shared/components/tooltip'
+import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
+import MaterialIcon from '@/shared/components/material-icon'
import React, { memo } from 'react'
import { useTranslation } from 'react-i18next'
@@ -19,24 +19,24 @@ export const OutlineToggleButton = memo<{
onClick={toggleExpanded}
aria-label={expanded ? t('hide_outline') : t('show_outline')}
>
-
{t('file_outline')}
{isPartial && (
-
-
-
+
-
+
)}
)
diff --git a/services/web/frontend/stylesheets/app/editor/ide-react.less b/services/web/frontend/stylesheets/app/editor/ide-react.less
index dbab28d9ae..c374eddaad 100644
--- a/services/web/frontend/stylesheets/app/editor/ide-react.less
+++ b/services/web/frontend/stylesheets/app/editor/ide-react.less
@@ -27,6 +27,7 @@
}
.ide-react-main {
+ //migrated to SCSS
height: 100%;
display: flex;
flex-direction: column;
@@ -39,6 +40,7 @@
}
.ide-react-body {
+ //migrated to SCSS
flex-grow: 1;
background-color: @pdf-bg;
overflow-y: hidden;
@@ -118,6 +120,7 @@
}
.ide-react-editor-sidebar {
+ //migrated to SCSS
height: 100%;
background-color: @file-tree-bg;
color: var(--neutral-20);
@@ -130,6 +133,7 @@
}
.ide-react-file-tree-panel {
+ //migrated to SCSS
display: flex;
flex-direction: column;
diff --git a/services/web/frontend/stylesheets/bootstrap-5/abstracts/mixins.scss b/services/web/frontend/stylesheets/bootstrap-5/abstracts/mixins.scss
index 057801b645..54cf94afcd 100644
--- a/services/web/frontend/stylesheets/bootstrap-5/abstracts/mixins.scss
+++ b/services/web/frontend/stylesheets/bootstrap-5/abstracts/mixins.scss
@@ -64,3 +64,25 @@
@mixin modal-sm {
max-width: 480px;
}
+
+// Toolbar
+@mixin toolbar-sm-height {
+ height: 32px;
+}
+
+@mixin toolbar-alt-bg() {
+ background-color: var(--bg-dark-secondary);
+}
+
+// Filetree
+@mixin file-tree-item-color {
+ color: var(--content-primary-dark);
+}
+
+@mixin file-tree-item-hover-bg {
+ background-color: var(--bg-dark-secondary);
+}
+
+@mixin file-tree-bg {
+ background-color: var(--bg-dark-tertiary);
+}
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss
index aaea331950..2d3ebd68df 100644
--- a/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss
@@ -1,4 +1,8 @@
@import 'account-settings';
@import 'project-list';
@import 'sidebar-v2-dash-pane';
-@import 'editor';
+@import 'editor/ide';
+@import 'editor/loading-screen';
+@import 'editor/outline';
+@import 'editor/file-tree';
+@import 'editor/toolbar';
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/file-tree.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/file-tree.scss
new file mode 100644
index 0000000000..98b42bd95f
--- /dev/null
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/file-tree.scss
@@ -0,0 +1,9 @@
+.ide-react-file-tree-panel {
+ display: flex;
+ flex-direction: column;
+
+ // Prevent the file tree expanding beyond the boundary of the panel
+ .file-tree {
+ width: 100%;
+ }
+}
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/ide.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/ide.scss
new file mode 100644
index 0000000000..be6c284cf6
--- /dev/null
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/ide.scss
@@ -0,0 +1,53 @@
+#ide-root {
+ height: 100vh; /* for backwards compatibility */
+ height: 100dvh; /* needed for mobile devices */
+
+ .global-alerts {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+
+ .chat {
+ position: relative;
+ height: 100%;
+ }
+
+ .review-panel-wrapper {
+ &.rp-state-overview {
+ position: sticky;
+ top: 0;
+ height: 100%;
+ }
+ }
+}
+
+.ide-react-editor-sidebar {
+ @include file-tree-bg;
+
+ height: 100%;
+ color: var(--content-secondary-dark);
+}
+
+.ide-react-body {
+ flex-grow: 1;
+ background-color: var(--bg-light-secondary);
+ overflow-y: hidden;
+ z-index: 0;
+}
+
+.ide-react-main {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+
+ .toolbar.toolbar-header {
+ position: static;
+ flex-grow: 0;
+ color: var(--neutral-20);
+ }
+}
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/loading-screen.scss
similarity index 82%
rename from services/web/frontend/stylesheets/bootstrap-5/pages/editor.scss
rename to services/web/frontend/stylesheets/bootstrap-5/pages/editor/loading-screen.scss
index 6c9a9ec75a..456c89a91c 100644
--- a/services/web/frontend/stylesheets/bootstrap-5/pages/editor.scss
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/loading-screen.scss
@@ -23,8 +23,8 @@
width: 100%;
padding-top: 115.44%;
height: 0;
- background: url(../../../../public/img/ol-brand/overleaf-o-grey.svg) no-repeat
- bottom / 100%;
+ background: url(../../../../../public/img/ol-brand/overleaf-o-grey.svg)
+ no-repeat bottom / 100%;
&::after {
content: '';
@@ -33,7 +33,7 @@
right: 0;
bottom: 0;
left: 0;
- background: url(../../../../public/img/ol-brand/overleaf-o.svg) no-repeat
+ background: url(../../../../../public/img/ol-brand/overleaf-o.svg) no-repeat
bottom / 100%;
transition: height 0.5s;
}
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss
new file mode 100644
index 0000000000..4ea50107d0
--- /dev/null
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/outline.scss
@@ -0,0 +1,213 @@
+.outline-container {
+ width: 100%;
+ height: 100%;
+ background-color: var(--bg-dark-tertiary);
+}
+
+.outline-pane {
+ @include body-sm;
+
+ display: flex;
+ flex-flow: column;
+ height: 100%;
+ color: var(--content-primary-dark);
+}
+
+.outline-pane-disabled {
+ opacity: 0.5;
+}
+
+.documentation-btn-container {
+ @include toolbar-sm-height;
+ @include toolbar-alt-bg;
+
+ display: flex;
+ align-items: center;
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
+
+ & *,
+ & :hover {
+ color: var(--content-primary-dark);
+ text-decoration: none;
+ }
+
+ &:hover {
+ background-color: var(--bg-dark-primary);
+ }
+}
+
+.documentation-close {
+ padding: 0;
+}
+
+.outline-header {
+ @include toolbar-sm-height;
+ @include toolbar-alt-bg;
+
+ display: flex;
+ flex-shrink: 0;
+ border-bottom: 1px solid var(--border-disabled-dark);
+ border-top: 1px solid var(--border-disabled-dark);
+}
+
+.outline-header-expand-collapse-btn {
+ @include file-tree-item-color;
+
+ display: flex;
+ align-items: center;
+ background-color: transparent;
+ border: 0;
+ padding: 0 var(--spacing-03) 0 0;
+ font-size: inherit;
+ vertical-align: inherit;
+ flex: 1 0 100%;
+ text-align: left;
+ white-space: nowrap;
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
+
+ &:hover,
+ &:focus {
+ outline: 0;
+ }
+
+ &:hover {
+ background-color: var(--bg-dark-primary);
+ }
+
+ &:hover[disabled] {
+ background-color: transparent;
+ }
+}
+
+.outline-header-name {
+ @include body-sm;
+ @include file-tree-item-color;
+
+ display: inline-block;
+ font-weight: 700;
+ margin: 0;
+ flex-grow: 1;
+ flex-shrink: 1;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.outline-body {
+ @include file-tree-bg;
+
+ overflow-y: auto;
+ padding-right: var(--spacing-03);
+}
+
+.outline-body-no-elements {
+ @include file-tree-item-color;
+
+ text-align: center;
+ padding: var(--spacing-08) var(--spacing-08) var(--spacing-11)
+ var(--spacing-08);
+ margin-right: calc(var(--spacing-03) * -1);
+}
+
+.outline-body-link {
+ @include file-tree-item-color;
+
+ display: block;
+ text-decoration: underline;
+
+ &:hover,
+ &:focus {
+ @include file-tree-item-color;
+
+ text-decoration: underline;
+ }
+}
+
+.outline-item-list {
+ position: relative;
+ list-style: none;
+ padding-left: var(--spacing-08);
+
+ &::before {
+ content: '';
+ background-color: var(--neutral-60);
+ top: var(--spacing-03);
+ bottom: var(--spacing-03);
+ width: 1px;
+ left: var(--spacing-10);
+ position: absolute;
+ }
+
+ &.outline-item-list-root {
+ padding-left: 0;
+
+ &::before {
+ left: var(--spacing-05);
+ }
+ }
+}
+
+.outline-item-no-children {
+ padding-left: var(--spacing-07);
+}
+
+.outline-item-row {
+ display: flex;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.outline-item-expand-collapse-btn {
+ @include file-tree-bg;
+
+ display: inline;
+ border: 0;
+ padding: 0;
+ font-size: inherit;
+ vertical-align: inherit;
+ position: relative;
+ z-index: 1;
+ color: var(--content-disabled);
+ margin-right: calc(var(--spacing-03) * -1);
+ border-radius: var(--border-radius-base);
+
+ &:hover,
+ &:focus {
+ outline: 0;
+ }
+
+ &:hover {
+ @include file-tree-item-hover-bg;
+ }
+}
+
+.outline-item-link {
+ @include file-tree-item-color;
+ @include text-truncate;
+
+ display: inline;
+ background-color: transparent;
+ border: 0;
+ position: relative;
+ z-index: 1;
+ padding: 0 var(--spacing-03);
+ line-height: var(--spacing-08);
+ border-radius: var(--border-radius-base);
+ text-align: left;
+
+ &:hover,
+ &:focus {
+ @include file-tree-item-hover-bg;
+
+ outline: 0;
+ }
+}
+
+.outline-item-link-highlight {
+ background-color: tint($bg-dark-tertiary, 15%);
+}
+
+.outline-caret-icon {
+ width: var(--spacing-08);
+ font-size: 17px;
+ text-align: center;
+}
diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
new file mode 100644
index 0000000000..d4281055c1
--- /dev/null
+++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/toolbar.scss
@@ -0,0 +1,8 @@
+$toolbar-height: 40px;
+
+.toolbar {
+ display: flex;
+ align-items: center;
+ height: $toolbar-height;
+ border-bottom: 1px solid var(--border-divider-dark);
+}