Skip to content

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

feat: add notes placeholder

thecodrr1c6886e50792
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 9dc1e0264..9ee517afb 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -8,25 +8,40 @@ import { Virtuoso as List } from "react-virtuoso";
const ListContainer = props => {
return (
<Flex flexDirection="column" flex="1 1 auto">
- <Search placeholder="Search" />
- <Flex
- flexDirection="column"
- flex="1 1 auto"
- sx={{
- marginTop: 2
- }}
- >
- <List
- style={{
- width: "100%",
- flex: "1 1 auto",
- height: "auto",
- overflowX: "hidden"
- }}
- totalCount={props.itemsLength}
- item={props.item}
- />
- </Flex>
+ {!props.itemsLength ? (
+ <Flex
+ flexDirection="column"
+ alignSelf="center"
+ justifyContent="center"
+ flex="1 1 auto"
+ >
+ <props.placeholder />
+ </Flex>
+ ) : (
+ <>
+ <Search placeholder={props.searchPlaceholder} />
+ <Flex
+ flexDirection="column"
+ flex="1 1 auto"
+ sx={{
+ marginTop: 2
+ }}
+ >
+ {props.children || (
+ <List
+ style={{
+ width: "100%",
+ flex: "1 1 auto",
+ height: "auto",
+ overflowX: "hidden"
+ }}
+ totalCount={props.itemsLength}
+ item={props.item}
+ />
+ )}
+ </Flex>
+ </>
+ )}
{props.button && (
<Button
Icon={props.button.icon || Icon.Plus}
diff --git a/apps/web/src/components/placeholders/notesplacholder.js b/apps/web/src/components/placeholders/notesplacholder.js
index 0185ef53b..a3e8134bf 100644
--- a/apps/web/src/components/placeholders/notesplacholder.js
+++ b/apps/web/src/components/placeholders/notesplacholder.js
@@ -115,13 +115,12 @@ const NotesPlaceholder = props => {
))}
</Flex>
<Text
- color="icon"
- width="80%"
+ color="gray"
marginTop={50}
alignSelf="center"
sx={{
textAlign: "center",
- fontSize: "body"
+ fontSize: "title"
}}
>
Notes you write appear here.
diff --git a/apps/web/src/views/Home.js b/apps/web/src/views/Home.js
index 7c4aa6413..136235e6c 100644
--- a/apps/web/src/views/Home.js
+++ b/apps/web/src/views/Home.js
@@ -8,6 +8,8 @@ import Search from "../components/search";
import Note from "../components/note";
import { useStore, store } from "../stores/note-store";
import { useStore as useEditorStore } from "../stores/editor-store";
+import ListContainer from "../components/list-container";
+import NotesPlaceholder from "../components/placeholders/notesplacholder";
function SearchBox(props) {
return (
@@ -30,8 +32,12 @@ function Home() {
const notes = useStore(store => store.notes);
const newSession = useEditorStore(store => store.newSession);
return (
- <Flex flexDirection="column" flex="1 1 auto">
- <SearchBox />
+ <ListContainer
+ itemsLength={notes.items.length}
+ placeholder={NotesPlaceholder}
+ searchPlaceholder={"Search your notes"}
+ button={{ content: "Make a new note", onClick: () => newSession() }}
+ >
<GroupList
style={{
width: "100%",
@@ -71,12 +77,7 @@ function Home() {
)
}
/>
- <Button
- Icon={Icon.Plus}
- content="Make a new note"
- onClick={() => newSession()}
- />
- </Flex>
+ </ListContainer>
);
}
export default Home;