diff --git a/components/Notifications.jsx b/components/Notifications.jsx deleted file mode 100644 index d35ff57..0000000 --- a/components/Notifications.jsx +++ /dev/null @@ -1,45 +0,0 @@ -import { checkmarkOutline, closeOutline } from 'ionicons/icons'; -import Button from './ui/Button'; -import Icon from './ui/Icon'; -import List from './ui/List'; -import ListItem from './ui/ListItem'; -import VirtualScroll from './ui/VirtualScroll'; - -const NotificationItem = ({ i }) => ( - - Notification -
- You have a new friend request -
-
- - -
-
-); - -const Notifications = () => ( -
-
-

Notifications

-
- - } - /> - -
-); - -export default Notifications; diff --git a/components/pages/Feed.jsx b/components/pages/Feed.jsx index b4fd0e2..50f15b1 100644 --- a/components/pages/Feed.jsx +++ b/components/pages/Feed.jsx @@ -1,7 +1,20 @@ import Card from '../ui/Card'; -import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/react'; -import { homeItems } from '../../store'; +import { + IonPage, + IonHeader, + IonToolbar, + IonTitle, + IonButtons, + IonButton, + IonIcon, + IonContent, +} from '@ionic/react'; +import Notifications from './Notifications'; +import { useState } from 'react'; +import { notificationsOutline } from 'ionicons/icons'; +import { getHomeItems } from '../../store/selectors'; +import Store from '../../store'; const FeedCard = ({ title, type, text, author, authorAvatar, image }) => ( @@ -20,24 +33,35 @@ const FeedCard = ({ title, type, text, author, authorAvatar, image }) => ( ); -const Home = () => ( - - - - Feed - - - - +const Feed = () => { + const homeItems = Store.useState(getHomeItems); + const [showNotifications, setShowNotifications] = useState(false); + + return ( + + - Feed + Feed + + setShowNotifications(true)}> + + + - {homeItems.map((i, index) => ( - - ))} - - -); + + + + Feed + + + setShowNotifications(false)} /> + {homeItems.map((i, index) => ( + + ))} + + + ); +}; -export default Home; +export default Feed; diff --git a/components/pages/Notifications.jsx b/components/pages/Notifications.jsx new file mode 100644 index 0000000..78c2a46 --- /dev/null +++ b/components/pages/Notifications.jsx @@ -0,0 +1,31 @@ +import { IonModal, IonHeader, IonToolbar, IonTitle, IonContent, IonList } from '@ionic/react'; +import VirtualScroll from '../ui/VirtualScroll'; + +const Notifications = ({ open, onDidDismiss }) => { + return ( + + + + Lists + + + + + + Notifications + + + + } + /> + + + + ); +}; + +export default Notifications; diff --git a/components/pages/Settings.jsx b/components/pages/Settings.jsx index 6af0832..6188338 100644 --- a/components/pages/Settings.jsx +++ b/components/pages/Settings.jsx @@ -1,10 +1,20 @@ +import { + IonPage, + IonHeader, + IonItem, + IonToolbar, + IonTitle, + IonContent, + IonList, + IonToggle, + IonLabel, +} from '@ionic/react'; + import Store from '../../store'; import * as selectors from '../../store/selectors'; - -import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonList } from '@ionic/react'; +import { setSettings } from '../../store/actions'; const Settings = () => { - const enableNotifications = Store.useState(); const settings = Store.useState(selectors.getSettings); return ( @@ -15,7 +25,20 @@ const Settings = () => { - + + + Enable Notifications + { + setSettings({ + ...settings, + enableNotifications: e.target.checked, + }); + }} + /> + + ); diff --git a/mock/index.js b/mock/index.js index 5536fb1..a3530a8 100644 --- a/mock/index.js +++ b/mock/index.js @@ -1,5 +1,47 @@ +export const images = [ + 'https://images.unsplash.com/photo-1610235554447-41505d7962f8?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=882&q=80', + 'https://images.unsplash.com/photo-1610212594948-370947a3ba0b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80', + 'https://images.unsplash.com/photo-1610155180433-9994da6a323b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=80', +]; + +export const homeItems = [ + { + title: 'Exploring Maui', + type: 'Blog', + text: 'We just got back from a trip to Maui, and we had a great time...', + author: 'Max Lynch', + authorAvatar: '/img/max.jpg', + image: images[0], + }, + { + title: 'Arctic Adventures', + type: 'Blog', + text: + 'Last month we took a trek to the Arctic Circle. The isolation was just what we needed after...', + author: 'Max Lynch', + authorAvatar: '/img/max.jpg', + image: images[1], + }, + { + title: 'Frolicking in the Faroe Islands', + type: 'Blog', + text: + 'The Faroe Islands are a North Atlantic archipelago located 320 kilometres (200 mi) north-northwest of Scotland...', + author: 'Max Lynch', + authorAvatar: '/img/max.jpg', + image: images[2], + }, +]; + +export const notifications = [ + { title: 'New friend request' }, + { title: 'Please change your password' }, + { title: 'You have a new message' }, + { title: 'Welcome to the app!' }, +]; + // Some fake lists -const lists = [ +export const lists = [ { name: 'Groceries', id: 'groceries', @@ -18,5 +60,3 @@ const lists = [ { name: 'Work', id: 'work', items: [{ name: 'TPS Report' }, { name: 'Set up email' }] }, { name: 'Reminders', id: 'reminders' }, ]; - -export { lists }; diff --git a/store/index.js b/store/index.js index d58fed0..046802c 100644 --- a/store/index.js +++ b/store/index.js @@ -1,41 +1,6 @@ import { Store as PullStateStore } from 'pullstate'; -import { lists } from '../mock'; - -export const images = [ - 'https://images.unsplash.com/photo-1610235554447-41505d7962f8?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=882&q=80', - 'https://images.unsplash.com/photo-1610212594948-370947a3ba0b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80', - 'https://images.unsplash.com/photo-1610155180433-9994da6a323b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=80', -]; - -export const homeItems = [ - { - title: 'Exploring Maui', - type: 'Blog', - text: 'We just got back from a trip to Maui, and we had a great time...', - author: 'Max Lynch', - authorAvatar: '/img/max.jpg', - image: images[0], - }, - { - title: 'Arctic Adventures', - type: 'Blog', - text: - 'Last month we took a trek to the Arctic Circle. The isolation was just what we needed after...', - author: 'Max Lynch', - authorAvatar: '/img/max.jpg', - image: images[1], - }, - { - title: 'Frolicking in the Faroe Islands', - type: 'Blog', - text: - 'The Faroe Islands are a North Atlantic archipelago located 320 kilometres (200 mi) north-northwest of Scotland...', - author: 'Max Lynch', - authorAvatar: '/img/max.jpg', - image: images[2], - }, -]; +import { lists, homeItems, notifications } from '../mock'; const Store = new PullStateStore({ safeAreaTop: 0, @@ -45,6 +10,7 @@ const Store = new PullStateStore({ currentPage: null, homeItems, lists, + notifications, settings: { enableNotifications: true, },