Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: put reminder bar and search box into scroll

thecodrr8234102add72
diff --git a/apps/web/src/common/height-calculator.js b/apps/web/src/common/height-calculator.js
index 7a86367e6..d93d389af 100644
--- a/apps/web/src/common/height-calculator.js
+++ b/apps/web/src/common/height-calculator.js
@@ -1,4 +1,4 @@
-const SINGLE_LINE_HEIGHT = 1.4;
+const SINGLE_LINE_HEIGHT = 1.3;
const DEFAULT_FONT_SIZE = 16;
const MAX_HEIGHTS = {
@@ -10,7 +10,7 @@ const MAX_HEIGHTS = {
function getNoteHeight(item) {
const { title, headline } = item;
let height = SINGLE_LINE_HEIGHT * 3;
- if (title.length > 30) height += SINGLE_LINE_HEIGHT;
+ if (title.length > 35) height += SINGLE_LINE_HEIGHT;
if (headline?.length > 0) height += SINGLE_LINE_HEIGHT;
if (headline?.length > 40) height += SINGLE_LINE_HEIGHT;
return height * DEFAULT_FONT_SIZE;
@@ -21,7 +21,7 @@ function getNotebookHeight(item) {
// at the minimum we will have a title and the info text
let height = SINGLE_LINE_HEIGHT * 3; // 2.8 = 2 lines
- if (title.length > 30) {
+ if (title.length > 35) {
height += SINGLE_LINE_HEIGHT; // title has become multiline
}
@@ -33,7 +33,7 @@ function getNotebookHeight(item) {
height += SINGLE_LINE_HEIGHT;
}
- if (description?.length > 40) {
+ if (description?.length > 50) {
height += SINGLE_LINE_HEIGHT;
}
return height * DEFAULT_FONT_SIZE;
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 540de47f9..84ac7841d 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -38,8 +38,6 @@ function ListContainer(props) {
</Flex>
) : (
<>
- <Search type={props.type} query={props.query} context={context} />
- <ReminderBar />
<Flex variant="columnFill" mt={2} data-test-id="note-list">
{props.children
? props.children
@@ -51,33 +49,60 @@ function ListContainer(props) {
height={height}
width={width}
itemKey={(index) => {
- const item = props.items[index];
- return item.id || item.title;
+ switch (index) {
+ case 0:
+ return "searchbar";
+ case 1:
+ return "reminderbar";
+ default:
+ const item = props.items[index - 2];
+ return item.id || item.title;
+ }
}}
- overscanCount={2}
+ overscanCount={3}
estimatedItemSize={profile.estimatedItemHeight}
itemSize={(index) => {
- const item = props.items[index];
- if (item.type === "header") {
- if (item.title === "Pinned") return 22;
- else return 22;
- } else {
- return profile.itemHeight(item);
+ switch (index) {
+ case 0:
+ return 45;
+ case 1:
+ return 85;
+ default:
+ const item = props.items[index - 2];
+ if (item.type === "header") {
+ if (item.title === "Pinned") return 22;
+ else return 22;
+ } else {
+ return profile.itemHeight(item);
+ }
}
}}
- itemCount={props.items.length}
+ itemCount={props.items.length + 2}
>
{({ index, style }) => {
- const item = props.items[index];
- return (
- <div key={item.id} style={style}>
- {item.type === "header" ? (
- <GroupHeader title={item.title} />
- ) : (
- profile.item(index, item, context)
- )}
- </div>
- );
+ switch (index) {
+ case 0:
+ return (
+ <Search
+ type={props.type}
+ query={props.query}
+ context={context}
+ />
+ );
+ case 1:
+ return <ReminderBar />;
+ default:
+ const item = props.items[index - 2];
+ return (
+ <div key={item.id} style={style}>
+ {item.type === "header" ? (
+ <GroupHeader title={item.title} />
+ ) : (
+ profile.item(index, item, context)
+ )}
+ </div>
+ );
+ }
}}
</List>
)}
diff --git a/apps/web/src/components/reminder-bar/index.js b/apps/web/src/components/reminder-bar/index.js
index 49564b681..e37067d66 100644
--- a/apps/web/src/components/reminder-bar/index.js
+++ b/apps/web/src/components/reminder-bar/index.js
@@ -13,6 +13,7 @@ function ReminderBar() {
if (!reminder) return null;
return (
<Flex
+ height={65}
p={2}
mt={2}
bg={"shade"}