Skip to content

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

web: improve search results ui

Abdullah Atta29edb3a3c37a
diff --git a/apps/web/src/components/search-result/index.tsx b/apps/web/src/components/search-result/index.tsx
index bdc8cfe88..1e98e6631 100644
--- a/apps/web/src/components/search-result/index.tsx
+++ b/apps/web/src/components/search-result/index.tsx
@@ -24,6 +24,7 @@ import { useEditorStore } from "../../stores/editor-store";
import ListItem from "../list-item";
import { ChevronDown, ChevronRight } from "../icons";
+import { noteMenuItems } from "../note";
type SearchResultProps = {
item: HighlightedResult;
@@ -54,18 +55,17 @@ function SearchResult(props: SearchResultProps) {
isFocused={isOpened}
isCompact={!match}
item={item}
+ menuItems={noteMenuItems}
onClick={() => {
let activeIndex = 0;
for (let i = 0; i <= (matchIndex || 0) - 1; ++i) {
activeIndex += item.content[i].length;
}
- useEditorStore
- .getState()
- .openSession(item.id, {
- rawContent: item.rawContent,
- force: true,
- activeSearchResultIndex: activeIndex
- });
+ useEditorStore.getState().openSession(item.id, {
+ rawContent: item.rawContent,
+ force: true,
+ activeSearchResultIndex: activeIndex
+ });
}}
onMiddleClick={() =>
useEditorStore.getState().openSession(item.id, {
@@ -112,7 +112,7 @@ function SearchResult(props: SearchResultProps) {
overflow: "hidden",
textOverflow: "ellipsis"
}),
- fontWeight: "body",
+ fontWeight: match ? "body" : "medium",
display: "block",
".match": {
bg: "accent-secondary",
@@ -146,9 +146,16 @@ function SearchResult(props: SearchResultProps) {
)
}
sx={{
- mb: "small",
- borderRadius: "default",
- paddingLeft: `${5 + (depth === 0 ? 0 : 15 * depth)}px`
+ ...(match
+ ? {
+ px: 1,
+ borderBottom: "1px solid var(--border)"
+ }
+ : {
+ my: "small",
+ borderRadius: "default"
+ }),
+ mx: 1
}}
/>
);
diff --git a/apps/web/src/views/all-notes.tsx b/apps/web/src/views/all-notes.tsx
index 3d6302fbf..3027a87db 100644
--- a/apps/web/src/views/all-notes.tsx
+++ b/apps/web/src/views/all-notes.tsx
@@ -86,16 +86,7 @@ function Home() {
if (filteredItems) {
return (
- <Box
- id="search-results"
- sx={{
- flex: 1,
- '[data-viewport-type="element"]': {
- px: 1,
- width: `calc(100% - ${2 * 6}px) !important`
- }
- }}
- >
+ <>
{filteredItems.length === 0 ? (
<Text
variant="body"
@@ -171,7 +162,7 @@ function Home() {
/>
</>
)}
- </Box>
+ </>
);
}