diff --git a/src/App.css b/src/App.css index 3553b66..14dcf38 100644 --- a/src/App.css +++ b/src/App.css @@ -1,3 +1,17 @@ +body { + background-image: url("./images/background.jpg"); + background-position: center; + background-attachment: fixed; + background-repeat: no-repeat; + background-size: cover; +} + +.containerWrapper { + background: rgb(255, 255, 255); + background: linear-gradient(180deg, rgba(255, 255, 255, 0.8897934173669468) 0%, rgba(255, 255, 255, 0.7805497198879552) 100%); + padding: 78px 20px 10px; +} + .fileContainer { overflow: hidden; position: relative; @@ -15,4 +29,8 @@ right: 0; text-align: right; top: 0; +} + +.item-done { + text-decoration: line-through; } \ No newline at end of file diff --git a/src/App.js b/src/App.js index ef6cdac..e2ef6f8 100644 --- a/src/App.js +++ b/src/App.js @@ -19,7 +19,7 @@ function App() { - + { - if (this.state.user) { - firebase.database().ref('user-items/' + this.state.user.uid + '/list') - .on('value', (snapshot) => { - let list = snapshot.val() - list ? this.setState({ userList: list }) : this.setState({ userList: [] }) - }) + if (this.state.user) { + firebase.database().ref('user-items/' + this.state.user.uid + '/list') + .on('value', (snapshot) => { + let list = snapshot.val() + list ? this.setState({ userList: list }) : this.setState({ userList: [] }) + }) + } } -} -addToList = (e) => { - const addedItem = e - addedItem.done = false - this.setState({ - userList: [...this.state.userList, addedItem] - }, () => firebase.database().ref('user-items/' + this.state.user.uid).set({ - list: [...this.state.userList] - })) -} + addToList = (e) => { + const addedItem = e + addedItem.done = false + this.setState({ + userList: [...this.state.userList, addedItem] + }, () => firebase.database().ref('user-items/' + this.state.user.uid).set({ + list: [...this.state.userList] + })) + } -removeFromList = (e) => { - const userlist = [...this.state.userList] - const index = this.state.userList.map(item => item.id).indexOf(e); - if (index > -1) { - userlist.splice(index, 1); + removeFromList = (e) => { + const userlist = [...this.state.userList] + const index = this.state.userList.map(item => item.id).indexOf(e); + if (index > -1) { + userlist.splice(index, 1); + } + this.setState({ + userList: userlist + + }, () => firebase.database().ref('user-items/' + this.state.user.uid).set({ + list: [...this.state.userList] + })) + } + markAsDone = (e) => { + const userlist = [...this.state.userList] + const index = this.state.userList.map(item => item.id).indexOf(e); + if (index > -1) { + console.log("done", userlist); + + userlist[index].done = !userlist[index].done; + } + this.setState({ + userList: userlist + + }, () => firebase.database().ref('user-items/' + this.state.user.uid).set({ + list: [...this.state.userList] + })) } - this.setState({ - userList: userlist - }, () => firebase.database().ref('user-items/' + this.state.user.uid).set({ - list: [...this.state.userList] - })) -} -render() { - return - {this.props.children} - -} + refresh = () => { + this.setState((prevState) => ({ + refresh: !prevState.refresh + })) + } + + render() { + return + {this.props.children} + + } } \ No newline at end of file diff --git a/src/images/background.jpg b/src/images/background.jpg new file mode 100644 index 0000000..a620aa1 Binary files /dev/null and b/src/images/background.jpg differ diff --git a/src/item-details/Item-details.js b/src/item-details/Item-details.js index 5be9471..c1f1585 100644 --- a/src/item-details/Item-details.js +++ b/src/item-details/Item-details.js @@ -33,7 +33,8 @@ export default function ItemDetails(props) { Tip: {item.proTip} - + + diff --git a/src/main-list/Main-list.js b/src/main-list/Main-list.js index 45a0277..fc87035 100644 --- a/src/main-list/Main-list.js +++ b/src/main-list/Main-list.js @@ -67,7 +67,7 @@ function MainList() { .map(item => ( - + - + diff --git a/src/navigation/Navigation.js b/src/navigation/Navigation.js index 525618a..6f36d53 100644 --- a/src/navigation/Navigation.js +++ b/src/navigation/Navigation.js @@ -1,5 +1,5 @@ import React, { useContext, useState } from 'react' -import { Icon, Menu, Button } from 'semantic-ui-react' +import { Icon, Menu, Button, Image, Label } from 'semantic-ui-react' import { Link } from 'react-router-dom'; import firebase from 'firebase' import { MyContext } from '../auth/Auth'; @@ -21,6 +21,9 @@ const Navigation = () => { onClick={handleItemClick} > + {context.state.userList.length > 0 && } My list @@ -42,9 +45,11 @@ const Navigation = () => { active={activeItem === 'user'} onClick={handleItemClick} > - - Your profile - + + diff --git a/src/user-list/AddToList.js b/src/user-list/AddToList.js index 71f70f6..1369fea 100644 --- a/src/user-list/AddToList.js +++ b/src/user-list/AddToList.js @@ -1,15 +1,34 @@ import React, { useContext } from 'react'; -import { Button, Icon } from 'semantic-ui-react' +import { Button, Icon, Label } from 'semantic-ui-react' import { MyContext } from '../auth/Auth' export function AddToList(props) { const userList = useContext(MyContext) function findItem(item) { return (userList.state.userList.map(item => item.id).indexOf(item.id)) } + const isPacked = () => userList.state.userList[findItem(props.item)].done return <> {(findItem(props.item) > -1) - ? + ? <> + + + {props.desc && + (isPacked() + ? + + : + ) + } + {props.list && + } + : diff --git a/src/user-list/User-list.js b/src/user-list/User-list.js index 0937b8d..c123ac1 100644 --- a/src/user-list/User-list.js +++ b/src/user-list/User-list.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Image, List, Segment, Loader, Dimmer } from 'semantic-ui-react'; +import { Image, List, Segment, Loader, Dimmer, Button } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { AddToList } from '../user-list/AddToList'; import { MyContext } from '../auth/Auth' @@ -65,28 +65,32 @@ export default class UserList extends React.Component { return <>

Things to pack

- + {this.context.state.userList.length < 1 + ? <>

Nothing to pack