diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index 5ae11c6..cdc4ec8 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -223,16 +223,20 @@ if (process.env.NODE_ENV === 'development') { name: 'Some guy', number: '123-4567', title: 'Car', + category: 'CAR', description: 'Selling this cool car', url: 'https://i.imgur.com/ROmGTwi.jpeg', + price: 400, + posted: '1/9/2021' }, { id: 2, name: 'Some other dude', number: '666-6666', title: 'Material', - description: 'Selling my wife', + description: 'Selling my wife olsdfjsdfk jfksdaj kasjfksf jdkasf jklasf jasklf jaskf', url: '', + price: 30, }, ], }, diff --git a/phone/src/apps/sellout/components/SelloutApp.tsx b/phone/src/apps/sellout/components/SelloutApp.tsx index 4a9d4b1..92e5262 100644 --- a/phone/src/apps/sellout/components/SelloutApp.tsx +++ b/phone/src/apps/sellout/components/SelloutApp.tsx @@ -6,11 +6,11 @@ import { SelloutListContainer } from "./SelloutList/SelloutListContainer"; import "./Sellout.css"; import {ListingForm} from "./form/ListingForm"; +import ItemModal from "./modal/ItemModal"; export const SelloutApp = () => { return ( - diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx index be5470d..d580d17 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx @@ -1,10 +1,9 @@ import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import { Button, Typography, Paper } from "@material-ui/core"; -import { ImageDisplay } from "../images/ImageDisplay"; import { ListItem } from "../../../../ui/components/ListItem"; -import ChatIcon from "@material-ui/icons/Chat"; -import PhoneIcon from "@material-ui/icons/Phone"; +import { useItemModal } from "../../hooks/useItemModal"; +import { useListingDetails } from "../../hooks/useListingDetails"; const useStyles = makeStyles((theme) => ({ root: { @@ -50,11 +49,33 @@ const useStyles = makeStyles((theme) => ({ }, listingImage: { + }, + price: { + fontWeight: 600, + paddingLeft: '10px', + fontFamily: "'Libre Franklin', sans-serif", + + }, + readMoreBtn: { + background: '#FF9472', + paddingLeft: '10px', + '&:hover': { + background: '#FE9485' + } } })); export const SelloutItem = (listing) => { const classes = useStyles(); + + const { setItemModal } = useItemModal() + const { setDetails } = useListingDetails(); + + const handleOpenListing = (listing) => { + setDetails(listing) + setItemModal(true) + } + return (
@@ -64,8 +85,14 @@ export const SelloutItem = (listing) => { {listing.title} - {listing.description} + {listing.description.slice(0, 30)}... + + ${listing.price} + +
{ return ( - - {listings.map((listing) => ( - - ))} - +
+ + + {listings.map((listing) => ( + + ))} + +
); }; diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx index 3aa019f..2856a10 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx @@ -5,6 +5,8 @@ import SelloutSearch from "../search/SelloutSearch" import {useListingModal} from "../../hooks/useListingModal"; import { makeStyles, Theme } from "@material-ui/core/styles"; +import { useItemModal } from "../../hooks/useItemModal"; +import ItemModal from "../modal/ItemModal"; const useStyles = makeStyles((theme: Theme) => ({ hidden: { @@ -17,13 +19,17 @@ const useStyles = makeStyles((theme: Theme) => ({ export const SelloutListContainer = () => { const { modal } = useListingModal() - const { listing } = useListing(); + const { itemModal } = useItemModal(); + const listing = useListing(); const classes = useStyles(); return (
- - + {itemModal ? ( + + ): ( + + )}
) }; diff --git a/phone/src/apps/sellout/components/SelloutList/item.styles.ts b/phone/src/apps/sellout/components/SelloutList/item.styles.ts index a49ab94..d3e50c1 100644 --- a/phone/src/apps/sellout/components/SelloutList/item.styles.ts +++ b/phone/src/apps/sellout/components/SelloutList/item.styles.ts @@ -44,7 +44,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, listingImage: { - } + }, })) export default useStyles; \ No newline at end of file diff --git a/phone/src/apps/sellout/components/form/ListingForm.tsx b/phone/src/apps/sellout/components/form/ListingForm.tsx index 5178d04..4c22654 100644 --- a/phone/src/apps/sellout/components/form/ListingForm.tsx +++ b/phone/src/apps/sellout/components/form/ListingForm.tsx @@ -21,7 +21,7 @@ const useStyles = makeStyles((theme) => ({ display: 'none' }, input: { - marginBottom: 25, + marginBottom: 20, fontFamily: "'Libre Franklin', sans-serif" }, textFieldInput: { @@ -85,6 +85,13 @@ export const ListingForm = () => { style={{ width: "80%" }} /> + + { inputProps={{ className: classes.multilineFieldInput }} style={{ width: "80%" }} multiline - rows={7} + rows={3} /> diff --git a/phone/src/apps/sellout/components/modal/ItemModal.tsx b/phone/src/apps/sellout/components/modal/ItemModal.tsx new file mode 100644 index 0000000..e2be070 --- /dev/null +++ b/phone/src/apps/sellout/components/modal/ItemModal.tsx @@ -0,0 +1,64 @@ +import React from 'react' +import { Button, Typography } from '@material-ui/core'; +import { useItemModal } from '../../hooks/useItemModal'; +import { useListingDetails } from '../../hooks/useListingDetails' +import useStyles from './modal.styles'; +import CloseIcon from '@material-ui/icons/Close'; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import { spawnSync } from 'child_process'; + +export default function ItemModal() { + const classes = useStyles(); + + const { details, setDetails } = useListingDetails(); + const { itemModal, setItemModal} = useItemModal(); + + const handleClose = () => { + setDetails(null); + setItemModal(false); + } + + return ( +
+ {/* Header part */} +
+ +
+ + {details.category} +
+
+ +
+
+ {details.title} + ${details.price} +
+ +
+
+ Author: {details.name} + + Category: {details.category} + + Posted: {details.posted} +
+
+ +
+

Listing Description

+

{details.description}

+
+ +
+ +
+ ) +} diff --git a/phone/src/apps/sellout/components/modal/modal.styles.ts b/phone/src/apps/sellout/components/modal/modal.styles.ts new file mode 100644 index 0000000..87629b6 --- /dev/null +++ b/phone/src/apps/sellout/components/modal/modal.styles.ts @@ -0,0 +1,124 @@ +import { makeStyles, Theme } from '@material-ui/core/styles'; + +const useStyles = makeStyles((theme: Theme ) => ({ + root: { + position: 'absolute', + width: "100%", + backgroundColor: '#F9F9F9', + height: '100%', + margin: "auto", + textAlign: "center", + fontFamily: "'Libre Franklin', sans-serif" + }, + hidden: { + display: 'none' + }, + header: { + background: 'red', + width: '100%', + height: '30%' + }, + closeButton: { + position: 'absolute', + background: '#fff', + outline: 'none', + color: '#838383', + top: 10, + left: 5, + border: 'none', + display: 'flex', + justifyContent: 'center', + fontFamily: "'Libre Franklin', sans-serif", + alignItems: 'center', + borderRadius: 50, + '&:hover': { + background: '#fff' + }, + + }, + editButton: { + position: 'absolute', + top: 10, + right: 5, + color: '#838383', + fontSize: '18px', + fontWeight: 500, + padding: 5, + outline: 'none', + width: '55', + border: 'none', + borderRadius: 10, + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + }, + category: { + background: '#2bad85', + position: 'absolute', + top: 10, + right: 100, + color: '#fff', + fontSize: '18px', + fontWeight: 500, + padding: 7, + outline: 'none', + width: '55', + border: 'none', + borderRadius: 10, + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + }, + content: { + width: '90%', + margin: 'auto', + }, + titleSection: { + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + height: '20px', + }, + listingTitle: { + textAlign: 'left', + width: '90%', + margin: 'auto', + marginTop: '5px', + color: '#000', + fontWeight: 600, + fontSize: '32px', + fontFamily: "'Libre Franklin', sans-serif", + borderBottom: '3px solid #838383', + }, + priceContainer: { + background: '#FF4747', + borderRadius: 10, + color: '#fff', + fontFamily: "'Libre Franklin', sans-serif", + marginTop: 35, + padding: 5 + }, + metaContainer: { + width: '90%', + marginTop: '3em' + }, + metaSection: { + display: 'block', + width: '90%', + paddingBottom: 5, + borderBottom: '2px solid #838383' + }, + metaDetail: { + color: '#000', + textAlign: 'left', + fontWeight: 600, + fontFamily: "'Libre Franklin', sans-serif", + }, + descContianer: { + float: 'left', + fontSize: '18', + color: '#504F4F' + } +})) + +export default useStyles; \ No newline at end of file diff --git a/phone/src/apps/sellout/components/search/SelloutSearch.tsx b/phone/src/apps/sellout/components/search/SelloutSearch.tsx index 33efc7d..7cfd0d5 100644 --- a/phone/src/apps/sellout/components/search/SelloutSearch.tsx +++ b/phone/src/apps/sellout/components/search/SelloutSearch.tsx @@ -20,7 +20,7 @@ const SelloutSearch = () => { return (
-

Marketplace

+

Marketplace

diff --git a/phone/src/apps/sellout/components/search/search.styles.ts b/phone/src/apps/sellout/components/search/search.styles.ts index e0111e8..93b038c 100644 --- a/phone/src/apps/sellout/components/search/search.styles.ts +++ b/phone/src/apps/sellout/components/search/search.styles.ts @@ -5,7 +5,8 @@ const useStyles = makeStyles((theme: Theme) => ({ fontFamily: "'Libre Franklin', sans-serif", fontSize: 32, textAlign: 'left', - paddingLeft: 25 + paddingLeft: 25, + textShadow: '0px 3px #504F4F', }, searchContainer: { width: '100%', @@ -37,6 +38,7 @@ const useStyles = makeStyles((theme: Theme) => ({ }, subMenuButton: { display: 'flex', + boxShadow: '0px 4px 4px 0px rgba(0, 0, 0, 0.25)', justifyContent: 'space-around', alignItems: 'center', backgroundColor: '#fff', diff --git a/phone/src/apps/sellout/hooks/state.ts b/phone/src/apps/sellout/hooks/state.ts index d02898b..730bae3 100644 --- a/phone/src/apps/sellout/hooks/state.ts +++ b/phone/src/apps/sellout/hooks/state.ts @@ -7,6 +7,14 @@ export const selloutState = { }), listingModal: atom({ key: 'listingModal', - default: true + default: false + }), + listingDetails: atom({ + key: 'listingDetails', + default: null, + }), + itemModal: atom({ + key: 'itemModal', + default: false }) }; diff --git a/phone/src/apps/sellout/hooks/useItemModal.ts b/phone/src/apps/sellout/hooks/useItemModal.ts new file mode 100644 index 0000000..9c8bfb7 --- /dev/null +++ b/phone/src/apps/sellout/hooks/useItemModal.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { selloutState } from './state'; + +export const useItemModal = () => { + const [itemModal, setItemModal] = useRecoilState(selloutState.itemModal); + return { itemModal, setItemModal}; +} \ No newline at end of file diff --git a/phone/src/apps/sellout/hooks/useListing.ts b/phone/src/apps/sellout/hooks/useListing.ts index f20defd..a6872d8 100644 --- a/phone/src/apps/sellout/hooks/useListing.ts +++ b/phone/src/apps/sellout/hooks/useListing.ts @@ -1,7 +1,9 @@ import { useRecoilValue } from "recoil"; import { selloutState } from "./state"; +import { Listings } from '../../../common/typings/listings'; + export const useListing = () => { - const listing = useRecoilValue(selloutState.listing); - return { listing }; + const listings = useRecoilValue(selloutState.listing); + return listings; }; diff --git a/phone/src/apps/sellout/hooks/useListingDetails.ts b/phone/src/apps/sellout/hooks/useListingDetails.ts new file mode 100644 index 0000000..b7f2458 --- /dev/null +++ b/phone/src/apps/sellout/hooks/useListingDetails.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { selloutState } from './state'; + +export const useListingDetails = () => { + const [details, setDetails] = useRecoilState(selloutState.listingDetails); + return { details, setDetails }; +} \ No newline at end of file diff --git a/phone/src/common/typings/listings.ts b/phone/src/common/typings/listings.ts index 1003a46..fb053af 100644 --- a/phone/src/common/typings/listings.ts +++ b/phone/src/common/typings/listings.ts @@ -2,6 +2,7 @@ export interface Listings { name: string; phone_number: string; title: string; - url?: string; + url: string; description: string; + price: number; } \ No newline at end of file