Style tabs

This commit is contained in:
Ian Philips 2022-09-28 12:21:16 -04:00
parent 38dbcd62f0
commit 13e8c16928
3 changed files with 15 additions and 16 deletions

View File

@ -48,17 +48,14 @@ export function ContractTabs(props: {
const tabs = buildArray( const tabs = buildArray(
{ {
title: `Comments ${ title: `Comments`,
openCommentBounties
? '(' + formatMoney(openCommentBounties) + ' Bounty)'
: ''
}`,
tooltip: openCommentBounties tooltip: openCommentBounties
? `The creator of this market will award bounties of ${formatMoney( ? `The creator of this market will award bounties of ${formatMoney(
COMMENT_BOUNTY_AMOUNT COMMENT_BOUNTY_AMOUNT
)} to good comments` )} to good comments`
: undefined, : undefined,
content: <CommentsTabContent contract={contract} />, content: <CommentsTabContent contract={contract} />,
inlineTabIcon: <span>({formatMoney(COMMENT_BOUNTY_AMOUNT)})</span>,
}, },
{ {
title: capitalize(PAST_BETS), title: capitalize(PAST_BETS),

View File

@ -4,13 +4,13 @@ import { ReactNode, useState } from 'react'
import { track } from '@amplitude/analytics-browser' import { track } from '@amplitude/analytics-browser'
import { Col } from './col' import { Col } from './col'
import { Tooltip } from 'web/components/tooltip' import { Tooltip } from 'web/components/tooltip'
import { Row } from 'web/components/layout/row'
type Tab = { type Tab = {
title: string title: string
tabIcon?: ReactNode
content: ReactNode content: ReactNode
// If set, show a badge with this content stackedTabIcon?: ReactNode
badge?: string inlineTabIcon?: ReactNode
tooltip?: string tooltip?: string
} }
@ -58,13 +58,15 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) {
)} )}
aria-current={activeIndex === i ? 'page' : undefined} aria-current={activeIndex === i ? 'page' : undefined}
> >
{tab.badge ? (
<span className="px-0.5 font-bold">{tab.badge}</span>
) : null}
<Col> <Col>
<Tooltip text={tab.tooltip}> <Tooltip text={tab.tooltip}>
{tab.tabIcon && <div className="mx-auto">{tab.tabIcon}</div>} {tab.stackedTabIcon && (
{tab.title} <Row className="justify-center">{tab.stackedTabIcon}</Row>
)}
<Row className={'gap-1 '}>
{tab.title}
{tab.inlineTabIcon}
</Row>
</Tooltip> </Tooltip>
</Col> </Col>
</a> </a>

View File

@ -192,7 +192,7 @@ export function UserPage(props: { user: User }) {
tabs={[ tabs={[
{ {
title: 'Markets', title: 'Markets',
tabIcon: <ScaleIcon className="h-5" />, stackedTabIcon: <ScaleIcon className="h-5" />,
content: ( content: (
<> <>
<Spacer h={4} /> <Spacer h={4} />
@ -202,7 +202,7 @@ export function UserPage(props: { user: User }) {
}, },
{ {
title: 'Portfolio', title: 'Portfolio',
tabIcon: <FolderIcon className="h-5" />, stackedTabIcon: <FolderIcon className="h-5" />,
content: ( content: (
<> <>
<Spacer h={4} /> <Spacer h={4} />
@ -214,7 +214,7 @@ export function UserPage(props: { user: User }) {
}, },
{ {
title: 'Comments', title: 'Comments',
tabIcon: <ChatIcon className="h-5" />, stackedTabIcon: <ChatIcon className="h-5" />,
content: ( content: (
<> <>
<Spacer h={4} /> <Spacer h={4} />