mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
parent
bd4291462e
commit
7a3e6fde7f
@ -26,6 +26,7 @@ interface Props {
|
||||
notesParentType: string;
|
||||
height: number;
|
||||
width: number;
|
||||
onContentHeightChange: (sameRow: boolean)=> void;
|
||||
}
|
||||
|
||||
interface Breakpoints {
|
||||
@ -179,10 +180,12 @@ function NoteListControls(props: Props) {
|
||||
if (breakpoint === dynamicBreakpoints.Xl) {
|
||||
noteControlsRef.current.style.flexDirection = 'row';
|
||||
searchAndSortRef.current.style.flex = '2 1 auto';
|
||||
props.onContentHeightChange(true);
|
||||
} else {
|
||||
noteControlsRef.current.style.flexDirection = 'column';
|
||||
props.onContentHeightChange(false);
|
||||
}
|
||||
}, [breakpoint, dynamicBreakpoints]);
|
||||
}, [breakpoint, dynamicBreakpoints, props.onContentHeightChange]);
|
||||
|
||||
useEffect(() => {
|
||||
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import * as React from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import NoteList from '../NoteList/NoteList';
|
||||
import NoteListControls from '../NoteListControls/NoteListControls';
|
||||
import { Size } from '../ResizableLayout/utils/types';
|
||||
@ -22,7 +22,15 @@ const StyledRoot = styled.div`
|
||||
|
||||
export default function NoteListWrapper(props: Props) {
|
||||
const theme = themeStyle(props.themeId);
|
||||
const controlHeight = theme.topRowHeight;
|
||||
const [controlHeight, setControlHeight] = useState(theme.topRowHeight);
|
||||
|
||||
const onContentHeightChange = (sameRow: boolean) => {
|
||||
if (sameRow) {
|
||||
setControlHeight(theme.topRowHeight);
|
||||
} else {
|
||||
setControlHeight(theme.topRowHeight * 2);
|
||||
}
|
||||
};
|
||||
|
||||
const noteListSize = useMemo(() => {
|
||||
return {
|
||||
@ -33,7 +41,7 @@ export default function NoteListWrapper(props: Props) {
|
||||
|
||||
return (
|
||||
<StyledRoot>
|
||||
<NoteListControls height={controlHeight} width={noteListSize.width}/>
|
||||
<NoteListControls height={controlHeight} width={noteListSize.width} onContentHeightChange={onContentHeightChange}/>
|
||||
<NoteList resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
||||
</StyledRoot>
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ const globalStyle: any = {
|
||||
toolbarPadding: 6,
|
||||
appearance: 'light',
|
||||
mainPadding: 12,
|
||||
topRowHeight: 81,
|
||||
topRowHeight: 50,
|
||||
editorPaddingLeft: 8,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user