-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import FormBounty from '@/components/global/FormBounty'; | ||
import FormClaim from '@/components/global/FormClaim'; | ||
import GameButton from '@/components/global/GameButton'; | ||
import React, { useState } from 'react'; | ||
import { toast } from 'react-toastify'; | ||
import { useAccount } from 'wagmi'; | ||
|
||
export default function NavBarMobile({ | ||
type, | ||
bountyId, | ||
}: { | ||
type: 'claim' | 'bounty'; | ||
bountyId?: string; | ||
}) { | ||
const [showForm, setShowForm] = useState(false); | ||
const account = useAccount(); | ||
return ( | ||
<> | ||
<nav className='fixed bottom-0 left-0 right-0 h-14 flex items-center justify-between px-8 z-50'> | ||
<div | ||
className='absolute inset-0 rounded-t-2xl bg-blue-300/80' | ||
style={{ | ||
WebkitMask: | ||
'radial-gradient(circle at center 5px, transparent 60px, white 60px)', | ||
mask: 'radial-gradient(circle at center 5px, transparent 60px, white 60px)', | ||
}} | ||
/> | ||
|
||
<p className='text-white font-semibold z-10'>create</p> | ||
|
||
<div className='w-[157px] h-[157px] -mt-8 relative z-10'> | ||
<div | ||
className='button bg-transparent rounded-full' | ||
onClick={() => { | ||
if (account.isConnected) { | ||
setShowForm(true); | ||
return; | ||
} | ||
toast.error('Please connect your wallet'); | ||
}} | ||
> | ||
<GameButton /> | ||
</div> | ||
</div> | ||
|
||
<p className='text-white font-semibold z-10'>{type}</p> | ||
</nav> | ||
|
||
{type === 'bounty' ? ( | ||
<FormBounty open={showForm} onClose={() => setShowForm(false)} /> | ||
) : ( | ||
bountyId && ( | ||
<FormClaim | ||
bountyId={bountyId} | ||
open={showForm} | ||
onClose={() => setShowForm(false)} | ||
/> | ||
) | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
export const useScreenSize = () => { | ||
const [isMobile, setIsMobile] = useState(false); | ||
|
||
useEffect(() => { | ||
const checkScreenSize = () => { | ||
setIsMobile(window.innerWidth < 768); | ||
}; | ||
checkScreenSize(); | ||
|
||
window.addEventListener('resize', checkScreenSize); | ||
|
||
return () => window.removeEventListener('resize', checkScreenSize); | ||
}, []); | ||
|
||
return isMobile; | ||
}; |