mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
This commit is contained in:
parent
1ad83d65ab
commit
a4658f0416
@ -27,7 +27,6 @@ interface Props {
|
|||||||
notesParentType: string;
|
notesParentType: string;
|
||||||
height: number;
|
height: number;
|
||||||
width: number;
|
width: number;
|
||||||
onContentHeightChange: (sameRow: boolean)=> void;
|
|
||||||
newNoteButtonEnabled: boolean;
|
newNoteButtonEnabled: boolean;
|
||||||
newTodoButtonEnabled: boolean;
|
newTodoButtonEnabled: boolean;
|
||||||
}
|
}
|
||||||
@ -41,7 +40,6 @@ interface Breakpoints {
|
|||||||
|
|
||||||
const StyledRoot = styled.div`
|
const StyledRoot = styled.div`
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: ${(props: any) => props.height}px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: ${(props: any) => props.theme.mainPadding}px;
|
padding: ${(props: any) => props.theme.mainPadding}px;
|
||||||
@ -185,12 +183,10 @@ function NoteListControls(props: Props) {
|
|||||||
if (breakpoint === dynamicBreakpoints.Xl) {
|
if (breakpoint === dynamicBreakpoints.Xl) {
|
||||||
noteControlsRef.current.style.flexDirection = 'row';
|
noteControlsRef.current.style.flexDirection = 'row';
|
||||||
searchAndSortRef.current.style.flex = '2 1 50%';
|
searchAndSortRef.current.style.flex = '2 1 50%';
|
||||||
props.onContentHeightChange(true);
|
|
||||||
} else {
|
} else {
|
||||||
noteControlsRef.current.style.flexDirection = 'column';
|
noteControlsRef.current.style.flexDirection = 'column';
|
||||||
props.onContentHeightChange(false);
|
|
||||||
}
|
}
|
||||||
}, [breakpoint, dynamicBreakpoints, props.onContentHeightChange]);
|
}, [breakpoint, dynamicBreakpoints]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));
|
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));
|
||||||
|
@ -23,28 +23,20 @@ const StyledRoot = styled.div`
|
|||||||
|
|
||||||
export default function NoteListWrapper(props: Props) {
|
export default function NoteListWrapper(props: Props) {
|
||||||
const theme = themeStyle(props.themeId);
|
const theme = themeStyle(props.themeId);
|
||||||
const [controlHeight, setControlHeight] = useState(theme.topRowHeight);
|
const [controlHeight] = useState(theme.topRowHeight);
|
||||||
|
|
||||||
const onContentHeightChange = (sameRow: boolean) => {
|
|
||||||
if (sameRow) {
|
|
||||||
setControlHeight(theme.topRowHeight);
|
|
||||||
} else {
|
|
||||||
setControlHeight(theme.topRowHeight * 2);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const noteListSize = useMemo(() => {
|
const noteListSize = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
width: props.size.width,
|
width: props.size.width,
|
||||||
height: props.size.height - controlHeight,
|
height: props.size.height,
|
||||||
};
|
};
|
||||||
}, [props.size, controlHeight]);
|
}, [props.size]);
|
||||||
|
|
||||||
// <NoteList resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
// <NoteList resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledRoot>
|
<StyledRoot>
|
||||||
<NoteListControls height={controlHeight} width={noteListSize.width} onContentHeightChange={onContentHeightChange}/>
|
<NoteListControls height={controlHeight} width={noteListSize.width}/>
|
||||||
<NoteList2 resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
<NoteList2 resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
||||||
</StyledRoot>
|
</StyledRoot>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user