[Demo] Add New button and Search placeholder

This commit is contained in:
Lauren Tan
2020-12-16 12:58:27 -05:00
parent f74d9b8027
commit 96dcfc693e
2 changed files with 24 additions and 8 deletions

View File

@@ -8,6 +8,7 @@
import Note from './Note.server';
import NoteList from './NoteList.server';
import EditButton from './EditButton.client';
export default function App({selectedId, isEditing}) {
return (
@@ -24,7 +25,16 @@ export default function App({selectedId, isEditing}) {
/>
<strong>React Notes</strong>
</section>
<nav>
<section className="sidebar-menu" role="menubar">
<form className="search" role="search">
<label className="offscreen" htmlFor="sidebar-search-input">
Search for a note by title
</label>
<input id="sidebar-search-input" placeholder="Search" />
</form>
<EditButton noteId={null}>New</EditButton>
</section>
<nav role="navigation">
<NoteList />
</nav>
</section>

View File

@@ -22,13 +22,19 @@ export default function Note({selectedId, isEditing}) {
: null;
if (note === null) {
return (
<div className="note--empty-state">
<span className="note-text--empty-state">
Click a note on the left to view something! 🥺
</span>
</div>
);
if (isEditing) {
return (
<NoteEditor noteId={null} initialTitle="Untitled" initialBody="" />
);
} else {
return (
<div className="note--empty-state">
<span className="note-text--empty-state">
Click a note on the left to view something! 🥺
</span>
</div>
);
}
}
let {id, title, body, updated_at} = note;