Moving to a todo app

This commit is contained in:
Max Lynch
2020-12-24 13:46:48 -06:00
parent aecaa1f897
commit 0056d6fe81
14 changed files with 330 additions and 180 deletions
+41
View File
@@ -0,0 +1,41 @@
import Store from '../store';
const MenuItem = ({ children, ...props }) => (
<li {...props}>
<a
href="#"
className="text-gray-800 hover:text-gray-400 block px-4 py-2 rounded-md text-base font-medium"
>
{children}
</a>
</li>
);
const MenuContent = () => {
const pages = Store.useState(s => s.pages);
const go = page => {
Store.update(s => {
console.log('Going to', page);
s.currentPage = page;
s.showMenu = false;
});
};
return (
<>
<div className="p-4">
<h2 className="text-xl select-none">Menu</h2>
</div>
<ul>
{pages.map(p => (
<MenuItem key={p.id} onClick={() => go(p)}>
{p.title}
</MenuItem>
))}
</ul>
</>
);
};
export default MenuContent;