Factor out section header
This commit is contained in:
parent
c1287a4a25
commit
6720375553
|
@ -97,17 +97,10 @@ function SearchSection(props: {
|
||||||
followed?: boolean
|
followed?: boolean
|
||||||
}) {
|
}) {
|
||||||
const { label, user, sort, yourBets, followed } = props
|
const { label, user, sort, yourBets, followed } = props
|
||||||
const href = `/home?s=${sort}`
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col>
|
<Col>
|
||||||
<SiteLink className="mb-2 text-xl" href={href}>
|
<SectionHeader label={label} href={`/home?s=${sort}`} />
|
||||||
{label}{' '}
|
|
||||||
<ArrowSmRightIcon
|
|
||||||
className="mb-0.5 inline h-6 w-6 text-gray-500"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
</SiteLink>
|
|
||||||
<ContractSearch
|
<ContractSearch
|
||||||
user={user}
|
user={user}
|
||||||
defaultSort={sort}
|
defaultSort={sort}
|
||||||
|
@ -134,13 +127,7 @@ function GroupSection(props: {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col>
|
<Col>
|
||||||
<SiteLink className="mb-2 text-xl" href={groupPath(group.slug)}>
|
<SectionHeader label={group.name} href={groupPath(group.slug)} />
|
||||||
{group.name}{' '}
|
|
||||||
<ArrowSmRightIcon
|
|
||||||
className="mb-0.5 inline h-6 w-6 text-gray-500"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
</SiteLink>
|
|
||||||
<ContractSearch
|
<ContractSearch
|
||||||
user={user}
|
user={user}
|
||||||
defaultSort={'score'}
|
defaultSort={'score'}
|
||||||
|
@ -159,15 +146,25 @@ function DailyMoversSection(props: { userId: string | null | undefined }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className="gap-2">
|
<Col className="gap-2">
|
||||||
<SiteLink className="text-xl" href={'/daily-movers'}>
|
<SectionHeader label="Daily movers" href="daily-movers" />
|
||||||
Daily movers{' '}
|
<ProbChangeTable changes={changes} />
|
||||||
|
</Col>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function SectionHeader(props: { label: string; href: string }) {
|
||||||
|
const { label, href } = props
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Row className="mb-3 items-center justify-between">
|
||||||
|
<SiteLink className="text-xl" href={href}>
|
||||||
|
{label}{' '}
|
||||||
<ArrowSmRightIcon
|
<ArrowSmRightIcon
|
||||||
className="mb-0.5 inline h-6 w-6 text-gray-500"
|
className="mb-0.5 inline h-6 w-6 text-gray-500"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
</SiteLink>
|
</SiteLink>
|
||||||
<ProbChangeTable changes={changes} />
|
</Row>
|
||||||
</Col>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user