generated from blockmatic-icebox/powerstack
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: restore sharing button on project landing
- Loading branch information
1 parent
0e71780
commit 0988b95
Showing
2 changed files
with
78 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,90 @@ | ||
import { ProjectWithAuction } from '@/lib/projects' | ||
import { ProjectShare } from '../project/project-share' | ||
import React, { ReactNode, Fragment } from 'react' | ||
|
||
interface ItemProps { | ||
label?: string | ||
value: string | ReactNode | ||
fields?: Array<{ label: string; value: string }> | ||
} | ||
|
||
function ListItem({ label, value }: ItemProps) { | ||
if (!label && React.isValidElement(value)) { | ||
// Directly return JSX elements | ||
return ( | ||
<div className="flex justify-between w-full"> | ||
<b>{value}</b> | ||
</div> | ||
) | ||
} | ||
|
||
export function AuctionInfo({ project }: { project: ProjectWithAuction }) { | ||
return ( | ||
<div className="grid items-center grid-cols-2 gap-5"> | ||
{fields.map((items, k) => ( | ||
<div | ||
key={k} | ||
className="flex flex-col w-full px-4 py-3 my-1 text-center rounded-sm bg-muted" | ||
> | ||
{items.map((item, ik) => ( | ||
<> | ||
<ListItem key={ik} {...item} /> | ||
{ik < items.length - 1 ? ( | ||
<hr className="w-full my-2 border-accent/50" /> | ||
) : null} | ||
</> | ||
))} | ||
</div> | ||
))} | ||
<div className="flex justify-between w-full"> | ||
<h3 className="flex justify-between w-full"> | ||
<span className="opacity-70">{label}: </span> | ||
<b>{typeof value === 'string' ? value : null}</b> | ||
</h3> | ||
</div> | ||
) | ||
} | ||
const fields: Array<Array<ItemProps>> = [ | ||
[ | ||
{ | ||
label: 'Presale Period', | ||
value: '5/15/24 - 6/30/24', | ||
fields: [] | ||
}, | ||
{ | ||
label: 'Fundraising Goal', | ||
value: '$150,000', | ||
fields: [] | ||
}, | ||
{ | ||
label: 'Max Allocation', | ||
value: '$5,000', | ||
fields: [] | ||
} | ||
], | ||
[ | ||
{ | ||
label: 'Token Sale Period', | ||
value: '7/1/24 - 7/30/24', | ||
fields: [] | ||
}, | ||
{ | ||
label: 'Fundraising Goal', | ||
value: '250,0000', | ||
fields: [] | ||
}, | ||
{ | ||
label: 'Max Allocation', | ||
value: '$10,000', | ||
fields: [] | ||
} | ||
], | ||
[ | ||
{ | ||
label: 'Ticker', | ||
value: 'BC', | ||
fields: [] | ||
} | ||
|
||
export function AuctionInfo({ project }: { project: ProjectWithAuction }) { | ||
const fields: Array<Array<ItemProps>> = [ | ||
[ | ||
{ label: 'Presale Period', value: '5/15/24 - 6/30/24' }, | ||
{ label: 'Fundraising Goal', value: '$150,000' }, | ||
{ label: 'Max Allocation', value: '$5,000' } | ||
], | ||
[ | ||
{ label: 'Token Sale Period', value: '7/1/24 - 7/30/24' }, | ||
{ label: 'Fundraising Goal', value: '$250,000' }, | ||
{ label: 'Max Allocation', value: '$10,000' } | ||
], | ||
[{ label: 'Ticker', value: 'BC' }], | ||
[ | ||
// Passing `project` to `ProjectShare` if it is required as a prop | ||
{ value: <ProjectShare project={project} /> } | ||
] | ||
] | ||
// [ | ||
// { | ||
// label: 'Base price', | ||
// value: '$99.99', | ||
// fields: [] | ||
// } | ||
// ] | ||
] | ||
|
||
function ListItem(props: ItemProps) { | ||
return ( | ||
<div className="flex justify-between w-full"> | ||
<h3 className="flex justify-between w-full"> | ||
<span className="opacity-70">{props.label}: </span> | ||
<b>{props.value}</b> | ||
</h3> | ||
<div className="grid items-center grid-cols-2 gap-5"> | ||
{fields.map((items, k) => { | ||
return React.isValidElement(items[0].value) ? ( | ||
items[0].value | ||
) : ( | ||
<div | ||
key={k} | ||
className="flex flex-col w-full px-4 py-3 my-1 text-center rounded-sm bg-muted" | ||
> | ||
{items.map((item, ik) => ( | ||
<Fragment key={ik}> | ||
<ListItem {...item} /> | ||
|
||
{ik < items.length - 1 && ( | ||
<hr className="w-full my-2 border-accent/50" /> | ||
)} | ||
</Fragment> | ||
))} | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
|
||
interface ItemProps { | ||
label: string | ||
value: string | ||
fields?: Array<{ label: string; value: string }> | ||
{ | ||
/* <div | ||
key={k} | ||
className="flex flex-col w-full px-4 py-3 my-1 text-center rounded-sm bg-muted" | ||
> | ||
{items.map((item, ik) => ( | ||
<ListItem key={ik} {...item} /> | ||
{ik < items.length - 1 && ( | ||
<hr className="w-full my-2 border-accent/50" /> | ||
)} )) } | ||
</div> */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters