From 40c853e595e448bc7c629253465e2b613563e553 Mon Sep 17 00:00:00 2001 From: jahooma Date: Fri, 14 Jan 2022 00:55:35 -0600 Subject: [PATCH] Reimplement hot markets with flex box, since I can't figure out how to make the css grid version not flash bad layout. --- web/components/contract-card.tsx | 7 ++++--- web/pages/index.tsx | 31 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index cbaf1c12..dd3a0fbe 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -17,15 +17,16 @@ import { TrendingUpIcon } from '@heroicons/react/solid' export function ContractCard(props: { contract: Contract showHotVolume?: boolean + className?: string }) { - const { contract, showHotVolume } = props + const { contract, showHotVolume, className } = props const { question, resolution } = contract const { probPercent } = contractMetrics(contract) return ( - -
  • + +
  • diff --git a/web/pages/index.tsx b/web/pages/index.tsx index d644a3f6..11ec9450 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -5,12 +5,13 @@ import { getHotContracts, listAllContracts, } from '../lib/firebase/contracts' -import { ContractsGrid } from '../components/contracts-list' import { Spacer } from '../components/layout/spacer' import { Page } from '../components/page' import { Title } from '../components/title' import { ActivityFeed } from './activity' import { getRecentComments, Comment } from '../lib/firebase/comments' +import { Col } from '../components/layout/col' +import { ContractCard } from '../components/contract-card' export async function getStaticProps() { const [contracts, hotContracts, recentComments] = await Promise.all([ @@ -39,16 +40,32 @@ const Home = (props: { return ( -
    - - <ContractsGrid contracts={hotContracts} showHotVolume /> - </div> - + <HotMarkets hotContracts={hotContracts} /> <Spacer h={10} /> - <ActivityFeed contracts={contracts} recentComments={recentComments} /> </Page> ) } +const HotMarkets = (props: { hotContracts: Contract[] }) => { + const { hotContracts } = props + const [c1, c2, c3, c4] = hotContracts + + return ( + <div className="w-full bg-indigo-50 border-2 border-indigo-100 p-6 rounded-lg shadow-md"> + <Title className="mt-0" text="🔥 Markets" /> + <Col className="gap-6"> + <Col className="md:flex-row gap-6"> + <ContractCard className="flex-1" contract={c1} showHotVolume /> + <ContractCard className="flex-1" contract={c2} showHotVolume /> + </Col> + <Col className="md:flex-row gap-6"> + <ContractCard className="flex-1" contract={c3} showHotVolume /> + <ContractCard className="flex-1" contract={c4} showHotVolume /> + </Col> + </Col> + </div> + ) +} + export default Home