mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(marketplace/nui): useListing interface
This commit is contained in:
1 parent
d443b794c3
commit
60bf8be58d
5 files changed
+13
-8
No files matched your search
@@ -8,7 +8,7 @@ export const SelloutList = ({ listings }) => {
|
|||||||
<div>
|
<div>
|
||||||
<SelloutSearch />
|
<SelloutSearch />
|
||||||
<List style={{ backgroundColor: '#F6F6F6' }}>
|
<List style={{ backgroundColor: '#F6F6F6' }}>
|
||||||
{listings.map((listing) => (
|
{listings?.map(listing => (
|
||||||
<SelloutItem key={listing.id} {...listing} />
|
<SelloutItem key={listing.id} {...listing} />
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ const useStyles = makeStyles((theme: Theme) => ({
|
|||||||
export const SelloutListContainer = () => {
|
export const SelloutListContainer = () => {
|
||||||
const { modal } = useListingModal();
|
const { modal } = useListingModal();
|
||||||
const { itemModal } = useItemModal();
|
const { itemModal } = useItemModal();
|
||||||
const listing = useListing();
|
const { listings } = useListing();
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<div className={modal ? classes.hidden : classes.show}>
|
<div className={modal ? classes.hidden : classes.show}>
|
||||||
{itemModal ? <ItemModal /> : <SelloutList listings={listing} />}
|
{itemModal ? <ItemModal /> : <SelloutList listings={listings} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -3,7 +3,7 @@ import { atom } from 'recoil';
|
|||||||
export const selloutState = {
|
export const selloutState = {
|
||||||
listing: atom({
|
listing: atom({
|
||||||
key: 'listing',
|
key: 'listing',
|
||||||
default: [],
|
default: null,
|
||||||
}),
|
}),
|
||||||
listingModal: atom({
|
listingModal: atom({
|
||||||
key: 'listingModal',
|
key: 'listingModal',
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { selloutState } from './state';
|
import { selloutState } from './state';
|
||||||
|
|
||||||
import { Listings } from '../../../common/typings/listings';
|
import { ListingProps } from '../../../common/typings/listings';
|
||||||
|
|
||||||
export const useListing = () => {
|
interface ListingHook {
|
||||||
|
listings: ListingProps[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useListing = (): ListingHook => {
|
||||||
const listings = useRecoilValue(selloutState.listing);
|
const listings = useRecoilValue(selloutState.listing);
|
||||||
return listings;
|
return { listings };
|
||||||
};
|
};
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export interface Listings {
|
export interface ListingProps {
|
||||||
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
phone_number: string;
|
phone_number: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
Reference in new issue
Block a user