mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(marketplace/nui): style overhaul | listing modal
This commit is contained in:
1 parent
9adc01f870
commit
361a8ac6eb
16 files changed
+286
-23
No files matched your search
+5
-1
@@ -223,16 +223,20 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
name: 'Some guy',
|
name: 'Some guy',
|
||||||
number: '123-4567',
|
number: '123-4567',
|
||||||
title: 'Car',
|
title: 'Car',
|
||||||
|
category: 'CAR',
|
||||||
description: 'Selling this cool car',
|
description: 'Selling this cool car',
|
||||||
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
||||||
|
price: 400,
|
||||||
|
posted: '1/9/2021'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'Some other dude',
|
name: 'Some other dude',
|
||||||
number: '666-6666',
|
number: '666-6666',
|
||||||
title: 'Material',
|
title: 'Material',
|
||||||
description: 'Selling my wife',
|
description: 'Selling my wife olsdfjsdfk jfksdaj kasjfksf jdkasf jklasf jasklf jaskf',
|
||||||
url: '',
|
url: '',
|
||||||
|
price: 30,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import { SelloutListContainer } from "./SelloutList/SelloutListContainer";
|
|||||||
|
|
||||||
import "./Sellout.css";
|
import "./Sellout.css";
|
||||||
import {ListingForm} from "./form/ListingForm";
|
import {ListingForm} from "./form/ListingForm";
|
||||||
|
import ItemModal from "./modal/ItemModal";
|
||||||
|
|
||||||
export const SelloutApp = () => {
|
export const SelloutApp = () => {
|
||||||
return (
|
return (
|
||||||
<AppWrapper id="sellout-app">
|
<AppWrapper id="sellout-app">
|
||||||
<SelloutTitle />
|
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<ListingForm />
|
<ListingForm />
|
||||||
<SelloutListContainer />
|
<SelloutListContainer />
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import { Button, Typography, Paper } from "@material-ui/core";
|
import { Button, Typography, Paper } from "@material-ui/core";
|
||||||
import { ImageDisplay } from "../images/ImageDisplay";
|
|
||||||
import { ListItem } from "../../../../ui/components/ListItem";
|
import { ListItem } from "../../../../ui/components/ListItem";
|
||||||
import ChatIcon from "@material-ui/icons/Chat";
|
import { useItemModal } from "../../hooks/useItemModal";
|
||||||
import PhoneIcon from "@material-ui/icons/Phone";
|
import { useListingDetails } from "../../hooks/useListingDetails";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -50,11 +49,33 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
listingImage: {
|
listingImage: {
|
||||||
|
|
||||||
|
},
|
||||||
|
price: {
|
||||||
|
fontWeight: 600,
|
||||||
|
paddingLeft: '10px',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
|
||||||
|
},
|
||||||
|
readMoreBtn: {
|
||||||
|
background: '#FF9472',
|
||||||
|
paddingLeft: '10px',
|
||||||
|
'&:hover': {
|
||||||
|
background: '#FE9485'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const SelloutItem = (listing) => {
|
export const SelloutItem = (listing) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const { setItemModal } = useItemModal()
|
||||||
|
const { setDetails } = useListingDetails();
|
||||||
|
|
||||||
|
const handleOpenListing = (listing) => {
|
||||||
|
setDetails(listing)
|
||||||
|
setItemModal(true)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={classes.root}>
|
<ListItem className={classes.root}>
|
||||||
<div className={classes.content}>
|
<div className={classes.content}>
|
||||||
@@ -64,8 +85,14 @@ export const SelloutItem = (listing) => {
|
|||||||
{listing.title}
|
{listing.title}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h6" className={classes.desc}>
|
<Typography variant="h6" className={classes.desc}>
|
||||||
{listing.description}
|
{listing.description.slice(0, 30)}...
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Typography variant="h6" className={classes.price}>
|
||||||
|
${listing.price}
|
||||||
|
</Typography>
|
||||||
|
<Button className={classes.readMoreBtn} onClick={() => handleOpenListing(listing)}>
|
||||||
|
Read more
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.imageSection}>
|
<div className={classes.imageSection}>
|
||||||
<div className={classes.listingImage} style={{
|
<div className={classes.listingImage} style={{
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { List } from "../../../../ui/components/List";
|
import { List } from "../../../../ui/components/List";
|
||||||
|
import SelloutSearch from "../search/SelloutSearch";
|
||||||
import { SelloutItem } from "./SelloutItem";
|
import { SelloutItem } from "./SelloutItem";
|
||||||
|
|
||||||
export const SelloutList = ({ listings }) => {
|
export const SelloutList = ({ listings }) => {
|
||||||
return (
|
return (
|
||||||
<List style={{ backgroundColor: '#F6F6F6' }}>
|
<div>
|
||||||
{listings.map((listing) => (
|
<SelloutSearch />
|
||||||
<SelloutItem key={listing.id} {...listing} />
|
<List style={{ backgroundColor: '#F6F6F6' }}>
|
||||||
))}
|
{listings.map((listing) => (
|
||||||
</List>
|
<SelloutItem key={listing.id} {...listing} />
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -5,6 +5,8 @@ import SelloutSearch from "../search/SelloutSearch"
|
|||||||
import {useListingModal} from "../../hooks/useListingModal";
|
import {useListingModal} from "../../hooks/useListingModal";
|
||||||
|
|
||||||
import { makeStyles, Theme } from "@material-ui/core/styles";
|
import { makeStyles, Theme } from "@material-ui/core/styles";
|
||||||
|
import { useItemModal } from "../../hooks/useItemModal";
|
||||||
|
import ItemModal from "../modal/ItemModal";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) => ({
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
hidden: {
|
hidden: {
|
||||||
@@ -17,13 +19,17 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
|
|
||||||
export const SelloutListContainer = () => {
|
export const SelloutListContainer = () => {
|
||||||
const { modal } = useListingModal()
|
const { modal } = useListingModal()
|
||||||
const { listing } = useListing();
|
const { itemModal } = useItemModal();
|
||||||
|
const listing = useListing();
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<div className={modal ? classes.hidden : classes.show}>
|
<div className={modal ? classes.hidden : classes.show}>
|
||||||
<SelloutSearch />
|
{itemModal ? (
|
||||||
<SelloutList listings={listing} />
|
<ItemModal />
|
||||||
|
): (
|
||||||
|
<SelloutList listings={listing} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@@ -44,7 +44,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
},
|
},
|
||||||
listingImage: {
|
listingImage: {
|
||||||
|
|
||||||
}
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
export default useStyles;
|
export default useStyles;
|
||||||
@@ -21,7 +21,7 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
display: 'none'
|
display: 'none'
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
marginBottom: 25,
|
marginBottom: 20,
|
||||||
fontFamily: "'Libre Franklin', sans-serif"
|
fontFamily: "'Libre Franklin', sans-serif"
|
||||||
},
|
},
|
||||||
textFieldInput: {
|
textFieldInput: {
|
||||||
@@ -85,6 +85,13 @@ export const ListingForm = () => {
|
|||||||
style={{ width: "80%" }}
|
style={{ width: "80%" }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<InputBase
|
||||||
|
className={classes.input}
|
||||||
|
placeholder="Category"
|
||||||
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
|
style={{ width: "80%" }}
|
||||||
|
/>
|
||||||
|
|
||||||
<InputBase
|
<InputBase
|
||||||
className={classes.input}
|
className={classes.input}
|
||||||
placeholder="Image or URL link"
|
placeholder="Image or URL link"
|
||||||
@@ -107,7 +114,7 @@ export const ListingForm = () => {
|
|||||||
inputProps={{ className: classes.multilineFieldInput }}
|
inputProps={{ className: classes.multilineFieldInput }}
|
||||||
style={{ width: "80%" }}
|
style={{ width: "80%" }}
|
||||||
multiline
|
multiline
|
||||||
rows={7}
|
rows={3}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button onClick={addListing} className={classes.postButton}>Post</Button>
|
<Button onClick={addListing} className={classes.postButton}>Post</Button>
|
||||||
|
|||||||
@@ -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 (
|
||||||
|
<div className={itemModal ? classes.root : classes.hidden}>
|
||||||
|
{/* Header part */}
|
||||||
|
<div
|
||||||
|
className={classes.header}
|
||||||
|
style={{
|
||||||
|
backgroundImage: `url(${details.url})`,
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button onClick={handleClose} className={classes.closeButton}>{<CloseIcon />}</button>
|
||||||
|
<div>
|
||||||
|
<button className={classes.editButton}>EDIT {<ExpandMoreIcon />}</button>
|
||||||
|
<span className={classes.category}>{details.category}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.content}>
|
||||||
|
<div className={classes.titleSection}>
|
||||||
|
<Typography className={classes.listingTitle}>{details.title}</Typography>
|
||||||
|
<span className={classes.priceContainer}>${details.price}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.metaContainer}>
|
||||||
|
<div className={classes.metaSection}>
|
||||||
|
<Typography className={classes.metaDetail}><span style={{ color: '#504F4F' }}>Author:</span> {details.name}</Typography>
|
||||||
|
|
||||||
|
<Typography className={classes.metaDetail}><span style={{ color: '#504F4F' }}>Category:</span> {details.category}</Typography>
|
||||||
|
|
||||||
|
<Typography className={classes.metaDetail}><span style={{ color: '#504F4F' }}>Posted:</span> {details.posted}</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.descContianer}>
|
||||||
|
<h2 style={{ color: '#000', fontWeight: 500 }}>Listing Description</h2>
|
||||||
|
<p style={{ float: 'left' }}>{details.description}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
@@ -20,7 +20,7 @@ const SelloutSearch = () => {
|
|||||||
return (
|
return (
|
||||||
<div className={classes.searchContainer}>
|
<div className={classes.searchContainer}>
|
||||||
<div className={classes.header}>
|
<div className={classes.header}>
|
||||||
<h2 className={classes.headerTitle}>Marketplace</h2>
|
<h2 className={classes.headerTitle}>Marketplace</h2>
|
||||||
<div className={classes.search}>
|
<div className={classes.search}>
|
||||||
<div className={classes.searchIcon}>
|
<div className={classes.searchIcon}>
|
||||||
<SearchIcon style={{ color: '#838383' }} />
|
<SearchIcon style={{ color: '#838383' }} />
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
fontFamily: "'Libre Franklin', sans-serif",
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
paddingLeft: 25
|
paddingLeft: 25,
|
||||||
|
textShadow: '0px 3px #504F4F',
|
||||||
},
|
},
|
||||||
searchContainer: {
|
searchContainer: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -37,6 +38,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
},
|
},
|
||||||
subMenuButton: {
|
subMenuButton: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
boxShadow: '0px 4px 4px 0px rgba(0, 0, 0, 0.25)',
|
||||||
justifyContent: 'space-around',
|
justifyContent: 'space-around',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
|
|||||||
@@ -7,6 +7,14 @@ export const selloutState = {
|
|||||||
}),
|
}),
|
||||||
listingModal: atom({
|
listingModal: atom({
|
||||||
key: 'listingModal',
|
key: 'listingModal',
|
||||||
default: true
|
default: false
|
||||||
|
}),
|
||||||
|
listingDetails: atom({
|
||||||
|
key: 'listingDetails',
|
||||||
|
default: null,
|
||||||
|
}),
|
||||||
|
itemModal: atom({
|
||||||
|
key: 'itemModal',
|
||||||
|
default: false
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
|
||||||
|
export const useItemModal = () => {
|
||||||
|
const [itemModal, setItemModal] = useRecoilState(selloutState.itemModal);
|
||||||
|
return { itemModal, setItemModal};
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
import { selloutState } from "./state";
|
import { selloutState } from "./state";
|
||||||
|
|
||||||
|
import { Listings } from '../../../common/typings/listings';
|
||||||
|
|
||||||
export const useListing = () => {
|
export const useListing = () => {
|
||||||
const listing = useRecoilValue(selloutState.listing);
|
const listings = useRecoilValue(selloutState.listing);
|
||||||
return { listing };
|
return listings;
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
|
||||||
|
export const useListingDetails = () => {
|
||||||
|
const [details, setDetails] = useRecoilState(selloutState.listingDetails);
|
||||||
|
return { details, setDetails };
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ export interface Listings {
|
|||||||
name: string;
|
name: string;
|
||||||
phone_number: string;
|
phone_number: string;
|
||||||
title: string;
|
title: string;
|
||||||
url?: string;
|
url: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
price: number;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user