+
);
diff --git a/components/ui/PageStack.jsx b/components/ui/PageStack.jsx
new file mode 100644
index 0000000..82bd08f
--- /dev/null
+++ b/components/ui/PageStack.jsx
@@ -0,0 +1,9 @@
+import classNames from 'classnames';
+
+const PageStack = ({ children, className, ...props }) => (
+
+ {children}
+
+);
+
+export default PageStack;
diff --git a/components/ui/TabBar.jsx b/components/ui/TabBar.jsx
index 667f04f..2954c6f 100644
--- a/components/ui/TabBar.jsx
+++ b/components/ui/TabBar.jsx
@@ -1,12 +1,13 @@
const TabBar = ({ children }) => (
-)
+);
-export default TabBar;
\ No newline at end of file
+export default TabBar;
diff --git a/components/ui/Toggle.jsx b/components/ui/Toggle.jsx
new file mode 100644
index 0000000..8729862
--- /dev/null
+++ b/components/ui/Toggle.jsx
@@ -0,0 +1,3 @@
+const Toggle = () =>
;
+
+export default Toggle;
diff --git a/components/ui/VirtualScroll.jsx b/components/ui/VirtualScroll.jsx
new file mode 100644
index 0000000..01ded4e
--- /dev/null
+++ b/components/ui/VirtualScroll.jsx
@@ -0,0 +1,5 @@
+import { Virtuoso } from 'react-virtuoso';
+
+const VirtualScroll = props =>
;
+
+export default VirtualScroll;
diff --git a/data/index.js b/data/index.js
deleted file mode 100644
index aa465bc..0000000
--- a/data/index.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Some fake filler data
-
-export const images = [
- 'https://images.unsplash.com/photo-1608091526083-86ae8489ae5c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
- 'https://images.unsplash.com/photo-1608050072262-7b26ba63fb46?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
- 'https://images.unsplash.com/photo-1607975218223-94f82613e833?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
- 'https://images.unsplash.com/photo-1608108707326-215150457c9f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
- 'https://images.unsplash.com/photo-1608057681073-9399f209e773?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
-];
-
-export const homeItems = [
- {
- title: 'Welcome',
- type: 'Blog',
- text: 'Welcome to the app!',
- author: 'Max',
- image: images[0],
- },
- {
- title: 'How to get started',
- type: 'Article',
- text: 'Getting started with the app is easy! Just follow these 100 steps',
- author: 'Max',
- image: images[1],
- },
- {
- title: 'Need help?',
- type: 'Support',
- text: "We're here to help. Available between the hours of 3am and 3:01am every day",
- author: 'Max',
- image: images[2],
- },
- {
- title: 'Welcome',
- type: 'Blog',
- text: 'Welcome to the app!',
- author: 'Max',
- image: images[3],
- },
- {
- title: 'Welcome',
- type: 'Blog',
- text: 'Welcome to the app!',
- author: 'Max',
- image: images[4],
- },
-];
diff --git a/pages/index.js b/pages/index.js
index e763f2a..e4fb5f4 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -1,7 +1,3 @@
-import { useState } from 'react';
-import { Virtuoso } from 'react-virtuoso';
-import { flash, flashOutline, cog, cogOutline, home, homeOutline } from 'ionicons/icons';
-
import Store from '../store';
import App from '../components/ui/App';
@@ -9,112 +5,34 @@ import Backdrop from '../components/ui/Backdrop';
import Menu from '../components/ui/Menu';
import Modal from '../components/ui/Modal';
import Nav from '../components/ui/Nav';
+import PageStack from '../components/ui/PageStack';
import Tab from '../components/ui/Tab';
import TabBar from '../components/ui/TabBar';
-import List from '../components/ui/List';
-import ListItem from '../components/ui/ListItem';
-import Button from '../components/ui/Button';
import { SafeAreaProvider } from '../components/ui/SafeArea';
-import Home from '../components/pages/Home';
-import Feed from '../components/pages/Feed';
-import Settings from '../components/pages/Settings';
import { useDrag } from 'react-use-gesture';
-const pages = [
- { id: 'home', title: 'Home', icon: homeOutline, selectedIcon: home, component: Home },
- {
- id: 'feed',
- title: 'Feed',
- icon: flashOutline,
- selectedIcon: flash,
- component: Feed,
- },
- {
- id: 'settings',
- title: 'Settings',
- icon: cogOutline,
- selectedIcon: cog,
- component: Settings,
- },
-];
+import Notifications from '../components/Notifications';
+import MenuContent from '../components/MenuContent';
const CurrentPage = ({ page }) => {
+ const pages = Store.useState(s => s.pages);
+
return (
-
+
{pages.map(p => {
const Page = p.component;
return ;
})}
-
+
);
};
-const MenuItem = ({ children }) => (
-
-
- {children}
-
-
-);
-const MenuContent = () => (
- <>
-
-
Menu
-
-
-
-
-
-
- >
-);
-
-const FakeNotification = ({ i }) => (
-
-
-
- You have a new friend request
-
-
-
-
-
-
-);
-
-const NotificationsContent = () => (
-
-
-
Notifications
-
-
- }
- />
-
-
-);
-
export default function Index() {
- const [page, setPage] = useState(pages[0]);
-
const showMenu = Store.useState(s => s.showMenu);
const showNotifications = Store.useState(s => s.showNotifications);
+ const currentPage = Store.useState(s => s.currentPage);
+ const pages = Store.useState(s => s.pages);
const closeMenu = () => {
Store.update(s => {
@@ -163,16 +81,25 @@ export default function Index() {
-
-
+
+
{pages.map(p => (
- setPage(p)} selected={p.id === page.id} />
+
+ Store.update(s => {
+ s.currentPage = p;
+ })
+ }
+ selected={p.id === currentPage.id}
+ />
))}
-
+
diff --git a/store/actions.js b/store/actions.js
new file mode 100644
index 0000000..080516d
--- /dev/null
+++ b/store/actions.js
@@ -0,0 +1,12 @@
+import Store from '.';
+
+export const setDone = (list, item, done) => {
+ Store.update((s, o) => {
+ const listIndex = o.lists.findIndex(l => l === list);
+ const itemIndex = o.lists[listIndex].items.findIndex(i => i === item);
+ s.lists[listIndex].items[itemIndex].done = done;
+ if (list === o.selectedList) {
+ s.selectedList = s.lists[listIndex];
+ }
+ });
+};
diff --git a/store/index.js b/store/index.js
index 07236a9..563d930 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,10 +1,96 @@
import { Store as PullStateStore } from 'pullstate';
+import { list, listOutline, cog, cogOutline, home, homeOutline } from 'ionicons/icons';
+
+import Home from '../components/pages/Home';
+import Lists from '../components/pages/Lists';
+import Settings from '../components/pages/Settings';
+
+// The available pages here
+const pages = [
+ { id: 'home', title: 'Home', icon: homeOutline, selectedIcon: home, component: Home },
+ {
+ id: 'lists',
+ title: 'Lists',
+ icon: listOutline,
+ selectedIcon: list,
+ component: Lists,
+ },
+ {
+ id: 'settings',
+ title: 'Settings',
+ icon: cogOutline,
+ selectedIcon: cog,
+ component: Settings,
+ },
+];
+
+export const images = [
+ 'https://images.unsplash.com/photo-1608091526083-86ae8489ae5c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
+ 'https://images.unsplash.com/photo-1608050072262-7b26ba63fb46?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
+ 'https://images.unsplash.com/photo-1607975218223-94f82613e833?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
+ 'https://images.unsplash.com/photo-1608108707326-215150457c9f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80',
+ 'https://images.unsplash.com/photo-1608057681073-9399f209e773?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80',
+];
+
+export const homeItems = [
+ {
+ title: 'Welcome',
+ type: 'Blog',
+ text: 'Welcome to the app!',
+ author: 'Max',
+ image: images[0],
+ },
+ {
+ title: 'How to get started',
+ type: 'Article',
+ text: 'Getting started with the app is easy! Just follow these 100 steps',
+ author: 'Max',
+ image: images[1],
+ },
+ {
+ title: 'Need help?',
+ type: 'Support',
+ text: "We're here to help. Available between the hours of 3am and 3:01am every day",
+ author: 'Max',
+ image: images[2],
+ },
+];
+
+// Some fake lists
+const lists = [
+ {
+ name: 'Groceries',
+ id: 'groceries',
+ items: [{ name: 'Apples' }, { name: 'Bananas' }, { name: 'Milk' }, { name: 'Ice Cream' }],
+ },
+ {
+ name: 'Hardware Store',
+ id: 'hardware',
+ items: [
+ { name: 'Circular Saw' },
+ { name: 'Tack Cloth' },
+ { name: 'Drywall' },
+ { name: 'Router' },
+ ],
+ },
+ { name: 'Work', id: 'work', items: [{ name: 'TPS Report' }, { name: 'Set up email' }] },
+ { name: 'Reminders', id: 'reminders' },
+];
+
const Store = new PullStateStore({
safeAreaTop: 0,
safeAreaBottom: 0,
showMenu: false,
showNotifications: false,
+ currentPage: pages[0],
+ pages,
+ homeItems,
+ lists,
+ selectedList: null,
+ settings: {
+ enableNotifications: true,
+ },
});
export default Store;