Home: Add floating plus button that takes you to /create

This commit is contained in:
James Grugett 2022-06-10 11:22:36 -05:00
parent 25c1e9c3a3
commit 86581a421a

View File

@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import Router from 'next/router' import Router, { useRouter } from 'next/router'
import { PlusSmIcon } from '@heroicons/react/solid'
import { Page } from 'web/components/page' import { Page } from 'web/components/page'
import { Col } from 'web/components/layout/col' import { Col } from 'web/components/layout/col'
@ -13,6 +14,8 @@ const Home = () => {
const user = useUser() const user = useUser()
const [contract, setContract] = useContractPage() const [contract, setContract] = useContractPage()
const router = useRouter()
if (user === null) { if (user === null) {
Router.replace('/') Router.replace('/')
return <></> return <></>
@ -36,6 +39,13 @@ const Home = () => {
}} }}
/> />
</Col> </Col>
<button
type="button"
className="fixed bottom-[70px] right-3 inline-flex items-center rounded-full border border-transparent bg-indigo-600 p-3 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 lg:hidden"
onClick={() => router.push('/create')}
>
<PlusSmIcon className="h-8 w-8" aria-hidden="true" />
</button>
</Page> </Page>
{contract && ( {contract && (