Skip to content
Snippets Groups Projects
Commit f1f09a3a authored by chris's avatar chris
Browse files

layout fix

parent ab0fb284
No related branches found
No related tags found
1 merge request!313Fill the gap
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import styled, { ThemeProvider } from 'styled-components'; import styled, { css, ThemeProvider } from 'styled-components';
import PanelGroup from 'react-panelgroup';
import { WaxContext, ComponentPlugin } from 'wax-prosemirror-core'; import { WaxContext, ComponentPlugin } from 'wax-prosemirror-core';
import { grid, th } from '@pubsweet/ui-toolkit'; import { grid, th } from '@pubsweet/ui-toolkit';
import { cokoTheme } from '../theme'; import { cokoTheme } from '../theme';
...@@ -17,6 +18,7 @@ const Wrapper = styled.div` ...@@ -17,6 +18,7 @@ const Wrapper = styled.div`
font-size: ${th('fontSizeBase')}; font-size: ${th('fontSizeBase')};
height: 100%; height: 100%;
line-height: ${grid(4)}; line-height: ${grid(4)};
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
...@@ -36,7 +38,7 @@ const TopMenu = styled.div` ...@@ -36,7 +38,7 @@ const TopMenu = styled.div`
border-bottom: ${th('borderWidth')} ${th('borderStyle')} ${th('colorBorder')}; border-bottom: ${th('borderWidth')} ${th('borderStyle')} ${th('colorBorder')};
border-top: ${th('borderWidth')} ${th('borderStyle')} ${th('colorBorder')}; border-top: ${th('borderWidth')} ${th('borderStyle')} ${th('colorBorder')};
display: flex; display: flex;
height: 40px; min-height: 40px;
user-select: none; user-select: none;
> div:not(:last-child) { > div:not(:last-child) {
...@@ -65,10 +67,9 @@ const EditorArea = styled.div` ...@@ -65,10 +67,9 @@ const EditorArea = styled.div`
const WaxSurfaceScroll = styled.div` const WaxSurfaceScroll = styled.div`
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
height: 88%; height: 100%;
overflow-y: auto; overflow-y: auto;
position: fixed; position: absolute;
top: 95px;
width: 100%; width: 100%;
/* PM styles for main content*/ /* PM styles for main content*/
${EditorElements}; ${EditorElements};
...@@ -79,11 +80,20 @@ const EditorContainer = styled.div` ...@@ -79,11 +80,20 @@ const EditorContainer = styled.div`
width: 100%; width: 100%;
.ProseMirror { .ProseMirror {
height: 100%; box-shadow: 0 0 8px #ecedf1;
min-height: 98%;
padding: ${grid(10)}; padding: ${grid(10)};
} }
`; `;
let surfaceHeight = (window.innerHeight / 5) * 3;
let notesHeight = (window.innerHeight / 5) * 2;
const onResizeEnd = arr => {
surfaceHeight = arr[0].size;
notesHeight = arr[1].size;
};
const MainMenuToolBar = ComponentPlugin('mainMenuToolBar'); const MainMenuToolBar = ComponentPlugin('mainMenuToolBar');
const WaxOverlays = ComponentPlugin('waxOverlays'); const WaxOverlays = ComponentPlugin('waxOverlays');
...@@ -112,11 +122,21 @@ const HhmiLayout = ({ editor }) => { ...@@ -112,11 +122,21 @@ const HhmiLayout = ({ editor }) => {
<TopMenu> <TopMenu>
<MainMenuToolBar /> <MainMenuToolBar />
</TopMenu> </TopMenu>
<Main> <Main>
<EditorArea> <EditorArea>
<WaxSurfaceScroll> <PanelGroup
<EditorContainer>{editor}</EditorContainer> direction="column"
</WaxSurfaceScroll> panelWidths={[
{ size: surfaceHeight, resize: 'stretch' },
{ size: notesHeight, resize: 'resize' },
]}
onResizeEnd={onResizeEnd}
>
<WaxSurfaceScroll>
<EditorContainer>{editor}</EditorContainer>
</WaxSurfaceScroll>
</PanelGroup>
</EditorArea> </EditorArea>
</Main> </Main>
<WaxOverlays /> <WaxOverlays />
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment