From 1222566d74b51e344f7554ffd4b7ab2f4035a04c Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Thu, 16 Jan 2025 10:00:49 +0000 Subject: [PATCH] Merge pull request #22787 from overleaf/mj-ide-rail [web] Create rail tabbed layout GitOrigin-RevId: be54a224087aad8e6e2762d9c26463e37aecd9aa --- .../ide-redesign/components/main-layout.tsx | 16 +-- .../features/ide-redesign/components/rail.tsx | 108 ++++++++++++++++++ .../stylesheets/bootstrap-5/pages/all.scss | 1 + .../bootstrap-5/pages/editor/rail.scss | 57 +++++++++ 4 files changed, 168 insertions(+), 14 deletions(-) create mode 100644 services/web/frontend/js/features/ide-redesign/components/rail.tsx create mode 100644 services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss diff --git a/services/web/frontend/js/features/ide-redesign/components/main-layout.tsx b/services/web/frontend/js/features/ide-redesign/components/main-layout.tsx index fb8e6b870c..1f314ad702 100644 --- a/services/web/frontend/js/features/ide-redesign/components/main-layout.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/main-layout.tsx @@ -3,15 +3,13 @@ import classNames from 'classnames' import { HorizontalResizeHandle } from '@/features/ide-react/components/resize/horizontal-resize-handle' import PdfPreview from '@/features/pdf-preview/components/pdf-preview' import { Editor } from './editor' +import { RailLayout } from './rail' export default function MainLayout() { return (
Toolbar
-
- Left menu -
- -
- Side bar -
-
+ File tree, + }, + { + key: 'integrations', + icon: 'integration_instructions', + component: <>Integrations, + }, + { + key: 'review-panel', + icon: 'rate_review', + component: <>Review panel, + }, + { + key: 'chat', + icon: 'forum', + component: <>Chat, + }, + { + key: 'errors', + icon: 'report', + component: <>Errors, + }, +] + +export const RailLayout = () => { + const [selectedTab, setSelectedTab] = useState( + RAIL_TABS[0]?.key + ) + return ( + setSelectedTab(key ?? undefined), [])} + id="ide-rail-tabs" + > +
+ +
+ +
+ + {RAIL_TABS.map(({ key, component }) => ( + + {component} + + ))} + +
+
+
+ ) +} + +const RailTab = ({ + icon, + eventKey, + active, +}: { + icon: AvailableUnfilledIcon + eventKey: string + active: boolean +}) => { + return ( + + + + ) +} diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss index 682f292cc3..956f28777c 100644 --- a/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/all.scss @@ -7,6 +7,7 @@ @import 'sidebar-v2-dash-pane'; @import 'editor/ide'; @import 'editor/ide-redesign'; +@import 'editor/rail'; @import 'editor/toolbar'; @import 'editor/online-users'; @import 'editor/hotkeys'; diff --git a/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss new file mode 100644 index 0000000000..17a8cd2ba7 --- /dev/null +++ b/services/web/frontend/stylesheets/bootstrap-5/pages/editor/rail.scss @@ -0,0 +1,57 @@ +:root { + --ide-rail-background: #fff; + --ide-rail-color: var(--neutral-90); + --ide-rail-link-background: #fff; + --ide-rail-link-active-background: var(--neutral-10); + --ide-rail-link-active-indicator-background: var(--neutral-90); +} + +.ide-rail-tab-link { + border-radius: 12px; + display: block; + height: 48px; + width: 48px; + text-align: center; + padding: 0; + color: var(--ide-rail-color); + background-color: var(--ide-rail-link-background); + position: relative; + overflow-y: hidden; + + .ide-rail-tab-link-icon { + line-height: 48px; + font-size: 20px; + } + + &.active { + color: var(--ide-rail-color); + background-color: var(--ide-rail-link-active-background); + + &::after { + $indicator-height: 3px; + + border-radius: 12px; + content: ''; + position: absolute; + bottom: -$indicator-height; + left: 25%; + box-sizing: border-box; + width: 50%; + height: $indicator-height * 2; + border: $indicator-height solid + var(--ide-rail-link-active-indicator-background); + background-color: var(--ide-rail-link-active-indicator-background); + } + } +} + +.ide-rail { + height: 100%; + padding: var(--spacing-02); + background: var(--ide-rail-background); +} + +.ide-rail-content { + height: 100%; + border: 1px solid var(--border-divider); +}