1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00

Desktop: Fixes #8194: Remove dead area at the end of the note list (#8825)

This commit is contained in:
CptMeetKat 2023-09-17 17:27:42 +10:00 committed by GitHub
parent 1ad83d65ab
commit a4658f0416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View File

@ -27,7 +27,6 @@ interface Props {
notesParentType: string;
height: number;
width: number;
onContentHeightChange: (sameRow: boolean)=> void;
newNoteButtonEnabled: boolean;
newTodoButtonEnabled: boolean;
}
@ -41,7 +40,6 @@ interface Breakpoints {
const StyledRoot = styled.div`
box-sizing: border-box;
height: ${(props: any) => props.height}px;
display: flex;
flex-direction: column;
padding: ${(props: any) => props.theme.mainPadding}px;
@ -185,12 +183,10 @@ function NoteListControls(props: Props) {
if (breakpoint === dynamicBreakpoints.Xl) {
noteControlsRef.current.style.flexDirection = 'row';
searchAndSortRef.current.style.flex = '2 1 50%';
props.onContentHeightChange(true);
} else {
noteControlsRef.current.style.flexDirection = 'column';
props.onContentHeightChange(false);
}
}, [breakpoint, dynamicBreakpoints, props.onContentHeightChange]);
}, [breakpoint, dynamicBreakpoints]);
useEffect(() => {
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));

View File

@ -23,28 +23,20 @@ const StyledRoot = styled.div`
export default function NoteListWrapper(props: Props) {
const theme = themeStyle(props.themeId);
const [controlHeight, setControlHeight] = useState(theme.topRowHeight);
const onContentHeightChange = (sameRow: boolean) => {
if (sameRow) {
setControlHeight(theme.topRowHeight);
} else {
setControlHeight(theme.topRowHeight * 2);
}
};
const [controlHeight] = useState(theme.topRowHeight);
const noteListSize = useMemo(() => {
return {
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}/>
return (
<StyledRoot>
<NoteListControls height={controlHeight} width={noteListSize.width} onContentHeightChange={onContentHeightChange}/>
<NoteListControls height={controlHeight} width={noteListSize.width}/>
<NoteList2 resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
</StyledRoot>
);