Merge pull request #15617 from overleaf/td-ide-page-show-pdf-divider

React IDE page: show PDF divider when PDF collapsed

GitOrigin-RevId: f535433a9f9c7683ae4144556a810247cda0f608
This commit is contained in:
Tim Down 2023-11-06 13:09:10 +00:00 committed by Copybot
parent 8144d431a6
commit ecf7befe88
3 changed files with 44 additions and 33 deletions

View file

@ -60,8 +60,7 @@ export default function EditorAndPdf({
{editorContent}
</Panel>
) : null}
{isDualPane ? (
<HorizontalResizeHandle>
<HorizontalResizeHandle resizable={isDualPane}>
<HorizontalToggler
id="editor-pdf"
togglerType="east"
@ -70,11 +69,12 @@ export default function EditorAndPdf({
tooltipWhenOpen={t('tooltip_hide_pdf')}
tooltipWhenClosed={t('tooltip_show_pdf')}
/>
{isDualPane ? (
<div className="synctex-controls">
<DefaultSynctexControl />
</div>
</HorizontalResizeHandle>
) : null}
</HorizontalResizeHandle>
{pdfIsOpen ? (
<Panel
ref={pdfPanelRef}

View file

@ -2,16 +2,21 @@ import { PanelResizeHandle } from 'react-resizable-panels'
import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import { PanelResizeHandleProps } from 'react-resizable-panels/dist/declarations/src/PanelResizeHandle'
import classNames from 'classnames'
export const HorizontalResizeHandle: FC<PanelResizeHandleProps> = ({
children,
...props
}) => {
export const HorizontalResizeHandle: FC<
{ resizable?: boolean } & PanelResizeHandleProps
> = ({ children, resizable = true, ...props }) => {
const { t } = useTranslation()
return (
<PanelResizeHandle {...props}>
<div className="horizontal-resize-handle" title={t('resize')}>
<div
className={classNames('horizontal-resize-handle', {
'horizontal-resize-handle-enabled': resizable,
})}
title={t('resize')}
>
{children}
</div>
</PanelResizeHandle>

View file

@ -55,6 +55,7 @@
border-width: 0;
}
&.horizontal-resize-handle-enabled {
&::before,
&::after {
// This SVG has the colour hard-coded to the current value of @ol-blue-gray-2, so if we changed @ol-blue-gray-2,
@ -73,6 +74,11 @@
&::after {
top: 75%;
}
}
&:not(.horizontal-resize-handle-enabled) {
cursor: default;
}
.synctex-controls {
left: -8px;