Delete your trades. Factor out section item

This commit is contained in:
James Grugett 2022-09-10 01:15:29 -05:00
parent 0a80fb7e1b
commit 88c098c64d

View File

@ -82,16 +82,13 @@ function DraggableList(props: {
{...provided.draggableProps} {...provided.draggableProps}
{...provided.dragHandleProps} {...provided.dragHandleProps}
style={provided.draggableProps.style} style={provided.draggableProps.style}
>
<SectionItem
className={clsx( className={clsx(
'flex flex-row items-center gap-4 rounded bg-gray-50 p-2',
snapshot.isDragging && 'z-[9000] bg-gray-300' snapshot.isDragging && 'z-[9000] bg-gray-300'
)} )}
> item={item}
<MenuIcon />
className="h-5 w-5 flex-shrink-0 text-gray-500"
aria-hidden="true"
/>{' '}
{item.label}
</div> </div>
)} )}
</Draggable> </Draggable>
@ -103,14 +100,35 @@ function DraggableList(props: {
) )
} }
const SectionItem = (props: {
item: { id: string; label: string }
className?: string
}) => {
const { item, className } = props
return (
<div
className={clsx(
className,
'flex flex-row items-center gap-4 rounded bg-gray-50 p-2'
)}
>
<MenuIcon
className="h-5 w-5 flex-shrink-0 text-gray-500"
aria-hidden="true"
/>{' '}
{item.label}
</div>
)
}
export const getHomeItems = ( export const getHomeItems = (
groups: Group[], groups: Group[],
homeSections: { visible: string[]; hidden: string[] } homeSections: { visible: string[]; hidden: string[] }
) => { ) => {
const items = [ const items = [
{ label: 'Trending', id: 'score' }, { label: 'Trending', id: 'score' },
{ label: 'Newest', id: 'newest' }, { label: 'New for you', id: 'newest' },
{ label: 'Your trades', id: 'your-bets' },
...groups.map((g) => ({ ...groups.map((g) => ({
label: g.name, label: g.name,
id: g.id, id: g.id,