Use media query instead of conditional render

This commit is contained in:
Sinclair Chen 2022-10-02 09:22:43 -07:00
parent cae35bc05e
commit 8484fcd54e

View File

@ -79,12 +79,16 @@ export function ContractEmbed(props: EmbedProps) {
creatorId: contract.creatorId, creatorId: contract.creatorId,
}) })
const { height = 0 } = useWindowSize() // return (height < 250px) ? Card : SmolView
return (
return height < 250 ? ( <>
<ContractCard contract={contract} className="h-screen" /> <div className="contents [@media(min-height:250px)]:hidden">
) : ( <ContractCard contract={contract} className="h-screen" />
<ContractSmolView {...props} /> </div>
<div className="hidden [@media(min-height:250px)]:contents">
<ContractSmolView {...props} />
</div>
</>
) )
} }