-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cutaways + scrollbar dismiss + search layout + mobile layout
- Loading branch information
Showing
33 changed files
with
844 additions
and
140 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,31 @@ | ||
import Link from 'next/link'; | ||
import {IconShare} from '@common/icons/IconShare'; | ||
|
||
import type {ReactElement} from 'react'; | ||
|
||
type TCutawayProps = { | ||
title: string; | ||
description: string; | ||
link: string; | ||
icon: ReactElement; | ||
}; | ||
|
||
export function Cutaway(props: TCutawayProps): ReactElement { | ||
return ( | ||
<Link | ||
href={props.link} | ||
target={'_blank'} | ||
className={'relative flex items-center justify-between bg-gray-600/20 p-6 hover:bg-gray-600/40'}> | ||
<div className={'flex flex-col md:flex-row'}> | ||
<div className={'flex size-20 items-center justify-center'}>{props.icon}</div> | ||
<div className={'md:ml-6'}> | ||
<p className={'mb-2 text-2xl font-bold text-gray-300'}>{props.title}</p> | ||
<p className={'text-base text-gray-400'}>{props.description}</p> | ||
</div> | ||
</div> | ||
<div className={'absolute right-7 top-7 md:static'}> | ||
<IconShare /> | ||
</div> | ||
</Link> | ||
); | ||
} |
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,87 @@ | ||
import Link from 'next/link'; | ||
import {usePathname} from 'next/navigation'; | ||
import {cl} from '@builtbymom/web3/utils'; | ||
import {IconCommunity} from '@common/icons/IconCommunity'; | ||
import {IconYearn} from '@common/icons/IconYearn'; | ||
import {IconYearnXApps} from '@common/icons/IconYearnXApps'; | ||
import {LogoDiscordRound} from '@common/icons/LogoDiscordRound'; | ||
import {LogoParagraphRound} from '@common/icons/LogoParagraphRound'; | ||
import {LogoTwitterRound} from '@common/icons/LogoTwitterRound'; | ||
import {LANDING_SIDEBAR_LINKS, MENU_TABS} from '@common/utils/constants'; | ||
|
||
import type {ReactElement} from 'react'; | ||
|
||
const iconsDict = { | ||
'/': <IconYearn />, | ||
community: <IconCommunity />, | ||
'yearn-x': <IconYearnXApps /> | ||
}; | ||
|
||
export function MobileNavbar({ | ||
set_isNavbarOpen, | ||
set_isSearchOpen | ||
}: { | ||
set_isNavbarOpen: (value: boolean) => void; | ||
set_isSearchOpen: (value: boolean) => void; | ||
}): ReactElement { | ||
const pathName = usePathname(); | ||
|
||
const currentTab = pathName?.startsWith('/home/') ? pathName?.split('/')[2] : '/'; | ||
return ( | ||
<div | ||
className={ | ||
'flex h-full w-screen flex-col justify-end border-t border-gray-600/50 bg-gradient-to-b from-gray-900 to-[#1A1A1A] ' | ||
}> | ||
<div className={'flex flex-col items-start gap-y-2 bg-transparent p-6 pb-4'}> | ||
{MENU_TABS.map(tab => ( | ||
<Link | ||
className={cl( | ||
'text-base flex items-center gap-x-2 py-2 text-gray-400', | ||
currentTab === tab.route ? 'text-white' : 'text-gray-400' | ||
)} | ||
onClick={() => { | ||
set_isSearchOpen(false); | ||
set_isNavbarOpen(false); | ||
}} | ||
href={tab.route === '/' ? tab.route : `/home/${tab.route}`}> | ||
<div className={'flex size-6 items-center justify-center'}> | ||
{iconsDict[tab.route as '/' | 'community' | 'yearn-x']} | ||
</div> | ||
<p>{tab.title}</p> | ||
</Link> | ||
))} | ||
</div> | ||
|
||
<div className={'w-full border-t border-gray-500 p-6'}> | ||
<div className={'flex w-full justify-between'}> | ||
{LANDING_SIDEBAR_LINKS.slice(0, 5).map(link => ( | ||
<Link | ||
href={link.href} | ||
className={'text-sm text-gray-400'} | ||
target={'_blank'}> | ||
{link.title} | ||
</Link> | ||
))} | ||
</div> | ||
|
||
<div className={'mt-6 flex gap-x-6'}> | ||
<Link | ||
target={'_blank'} | ||
href={'https://discord.com/invite/yearn'}> | ||
<LogoDiscordRound /> | ||
</Link> | ||
<Link | ||
target={'_blank'} | ||
href={''}> | ||
<LogoParagraphRound /> | ||
</Link> | ||
<Link | ||
target={'_blank'} | ||
href={'https://twitter.com/yearnfi'}> | ||
<LogoTwitterRound /> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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,75 @@ | ||
import {type ReactElement, useCallback} from 'react'; | ||
import {useRouter} from 'next/navigation'; | ||
import {useSearch} from '@common/contexts/useSearch'; | ||
import {IconBurger} from '@common/icons/IconBurger'; | ||
import {IconSearch} from '@common/icons/IconSearch'; | ||
import {LogoYearn} from '@common/icons/LogoYearn'; | ||
|
||
import {SearchBar} from './SearchBar'; | ||
|
||
export function MobileTopNav({ | ||
isSearchOpen, | ||
set_isSearchOpen, | ||
set_isNavbarOpen | ||
}: { | ||
isSearchOpen: boolean; | ||
set_isSearchOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
set_isNavbarOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
}): ReactElement { | ||
const {configuration, dispatch} = useSearch(); | ||
const router = useRouter(); | ||
|
||
const onSearchClick = useCallback(() => { | ||
if (!configuration.searchValue) { | ||
return; | ||
} | ||
router.push(`/home/search?query=${configuration.searchValue}`); | ||
}, [configuration.searchValue, router]); | ||
|
||
return ( | ||
<div className={'z-50 bg-gray-900'}> | ||
<div className={'flex w-full justify-between bg-gray-900 p-6'}> | ||
<div className={'flex items-center'}> | ||
<button | ||
className={'mr-4'} | ||
onClick={() => set_isNavbarOpen(prev => !prev)}> | ||
<IconBurger /> | ||
</button> | ||
<button | ||
onClick={() => { | ||
router.push('/'); | ||
set_isSearchOpen(false); | ||
}}> | ||
<LogoYearn | ||
className={'size-8'} | ||
back={'text-blue-500'} | ||
front={'text-white'} | ||
/> | ||
</button> | ||
</div> | ||
<div> | ||
<button | ||
onClick={() => { | ||
set_isNavbarOpen(false); | ||
set_isSearchOpen(prev => !prev); | ||
}}> | ||
<IconSearch /> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
{isSearchOpen && ( | ||
<div className={'!w-full bg-gray-900 px-6 pb-6'}> | ||
<SearchBar | ||
className={'!max-w-none !border-0 !border-white !bg-gray-500 text-white '} | ||
searchValue={configuration.searchValue} | ||
onSearch={(value: string) => dispatch({type: 'SET_SEARCH', payload: value})} | ||
searchPlaceholder={'Search Apps'} | ||
onSearchClick={onSearchClick} | ||
shouldSearchByClick | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.