Extract out a title component

This commit is contained in:
Austin Chen 2021-12-10 16:54:41 -08:00
parent 07b454a780
commit b4a1d8ca6f
3 changed files with 13 additions and 11 deletions

8
web/components/title.tsx Normal file
View File

@ -0,0 +1,8 @@
export function Title(props: { text: string }) {
const { text } = props
return (
<h1 className="text-2xl font-major-mono text-indigo-700 font-bold mt-6 mb-4">
{text}
</h1>
)
}

View File

@ -5,6 +5,7 @@ import { useUser } from '../hooks/use-user'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { Contract, listContracts } from '../lib/firebase/contracts' import { Contract, listContracts } from '../lib/firebase/contracts'
import { ContractsList } from '../components/contracts-list' import { ContractsList } from '../components/contracts-list'
import { Title } from '../components/title'
export default function Account() { export default function Account() {
const user = useUser() const user = useUser()
@ -46,9 +47,7 @@ export default function Account() {
</div> </div>
</div> </div>
<h1 className="text-2xl font-major-mono text-indigo-700 font-bold mt-6 mb-4"> <Title text="Contracts" />
Your markets
</h1>
<ContractsList contracts={contracts} /> <ContractsList contracts={contracts} />
</div> </div>
</div> </div>

View File

@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import { ContractsList } from '../../components/contracts-list' import { ContractsList } from '../../components/contracts-list'
import { Header } from '../../components/header' import { Header } from '../../components/header'
import { Spacer } from '../../components/layout/spacer' import { Spacer } from '../../components/layout/spacer'
import { Title } from '../../components/title'
import { useUser } from '../../hooks/use-user' import { useUser } from '../../hooks/use-user'
import { import {
Contract, Contract,
@ -55,9 +56,7 @@ export default function NewContract() {
<div> <div>
<Header /> <Header />
<div className="max-w-4xl py-12 lg:mx-auto px-4"> <div className="max-w-4xl py-12 lg:mx-auto px-4">
<h1 className="text-2xl font-major-mono text-indigo-700 font-bold my-6"> <Title text="Create a new prediction market" />
Create a new prediction market
</h1>
<div className="w-full bg-gray-200 rounded-lg shadow-xl p-6"> <div className="w-full bg-gray-200 rounded-lg shadow-xl p-6">
{/* Create a Tailwind form that takes in all the fields needed for a new contract */} {/* Create a Tailwind form that takes in all the fields needed for a new contract */}
{/* When the form is submitted, create a new contract in the database */} {/* When the form is submitted, create a new contract in the database */}
@ -175,11 +174,7 @@ export default function NewContract() {
<Spacer h={10} /> <Spacer h={10} />
{/* Show a separate card for each contract */} <Title text="Your markets" />
<h1 className="text-2xl font-major-mono text-indigo-700 font-bold my-6">
Your markets
</h1>
<ContractsList contracts={contracts} /> <ContractsList contracts={contracts} />
</div> </div>
</div> </div>