-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from G7DAO/feat/network-toggle
Feat/network toggle
- Loading branch information
Showing
8 changed files
with
132 additions
and
103 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
154 changes: 78 additions & 76 deletions
154
webapps/world-builder-dashboard/src/components/landing/Navbar.tsx
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 |
---|---|---|
@@ -1,88 +1,90 @@ | ||
// Navbar.tsx | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import styles from './Landing.module.css'; | ||
import IconGame7Logo from '@/assets/IconGame7Logo'; | ||
import IconGame7 from '@/assets/IconGame7'; | ||
import IconHamburgerLanding from '@/assets/IconHamburgerLanding'; | ||
import React from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
import styles from './Landing.module.css' | ||
import IconGame7 from '@/assets/IconGame7' | ||
import IconGame7Logo from '@/assets/IconGame7Logo' | ||
import IconHamburgerLanding from '@/assets/IconHamburgerLanding' | ||
|
||
interface NavbarProps { | ||
navbarOpen: boolean; | ||
smallView: boolean; | ||
setIsNavbarOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
startBuilding: () => void; | ||
navigateLink: (item: {name: string, link: string}) => void; | ||
navbarOpen: boolean | ||
smallView: boolean | ||
setIsNavbarOpen: React.Dispatch<React.SetStateAction<boolean>> | ||
startBuilding: () => void | ||
navigateLink: (item: { name: string; link: string }) => void | ||
} | ||
|
||
const NAVBAR_ITEMS = [ | ||
{ name: 'Home', link: '/' }, | ||
{ name: 'Faucet', link: 'faucet' }, | ||
{ name: 'Bridge', link: 'bridge' }, | ||
{ name: 'Community', link: 'https://discord.com/invite/g7dao' }, | ||
{ | ||
name: 'Docs', | ||
link: 'https://wiki.game7.io/g7-developer-resource/bWmdEUXVjGpgIbH3H5XT/introducing-the-g7-network/world-builder' | ||
} | ||
]; | ||
{ name: 'Home', link: '/' }, | ||
{ name: 'Faucet', link: 'faucet' }, | ||
{ name: 'Bridge', link: 'bridge' }, | ||
{ name: 'Community', link: 'https://discord.com/invite/g7dao' }, | ||
{ | ||
name: 'Docs', | ||
link: 'https://wiki.game7.io/g7-developer-resource/bWmdEUXVjGpgIbH3H5XT/introducing-the-g7-network/world-builder' | ||
} | ||
] | ||
|
||
const Navbar: React.FC<NavbarProps> = ({ navbarOpen, smallView, setIsNavbarOpen, startBuilding, navigateLink }) => { | ||
const navigate = useNavigate(); | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<> | ||
{/* Main Navbar */} | ||
<div className={styles.navbarContainer}> | ||
<div className={styles.navbar}> | ||
<div className={styles.logoWrapper} onClick={() => navigate('/')}> | ||
<IconGame7Logo /> | ||
<IconGame7 /> | ||
</div> | ||
<div className={styles.navbarItemsContainer}> | ||
{!smallView ? ( | ||
<div className={styles.navbarItems}> | ||
{NAVBAR_ITEMS.map((item, index) => ( | ||
<div | ||
key={index} | ||
className={item.name === 'Home' ? styles.navbarItemHome : styles.navbarItem} | ||
onClick={() => {navigateLink(item)}} | ||
> | ||
{item.name} | ||
</div> | ||
))} | ||
<div className={styles.navbarCTA} onClick={startBuilding}> | ||
Start building | ||
</div> | ||
</div> | ||
) : ( | ||
<div className={styles.navbarItem}> | ||
<IconHamburgerLanding onClick={() => setIsNavbarOpen(!navbarOpen)} /> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{/* Expanded Navbar for small view */} | ||
{navbarOpen && smallView && ( | ||
<div className={styles.navContainer}> | ||
{NAVBAR_ITEMS.map((item, index) => ( | ||
<div | ||
key={index} | ||
className={item.name === 'Home' ? styles.navItemHome : styles.navItem} | ||
onClick={() => navigateLink(item)} | ||
> | ||
{item.name} | ||
</div> | ||
))} | ||
<div className={styles.ctaContainer}> | ||
<div className={styles.startBuildingCTA} onClick={startBuilding}> | ||
Start building | ||
</div> | ||
</div> | ||
return ( | ||
<> | ||
{/* Main Navbar */} | ||
<div className={styles.navbarContainer}> | ||
<div className={styles.navbar}> | ||
<div className={styles.logoWrapper} onClick={() => navigate('/')}> | ||
<IconGame7Logo /> | ||
<IconGame7 /> | ||
</div> | ||
<div className={styles.navbarItemsContainer}> | ||
{!smallView ? ( | ||
<div className={styles.navbarItems}> | ||
{NAVBAR_ITEMS.map((item, index) => ( | ||
<div | ||
key={index} | ||
className={item.name === 'Home' ? styles.navbarItemHome : styles.navbarItem} | ||
onClick={() => { | ||
navigateLink(item) | ||
}} | ||
> | ||
{item.name} | ||
</div> | ||
))} | ||
<div className={styles.navbarCTA} onClick={startBuilding}> | ||
Start building | ||
</div> | ||
</div> | ||
) : ( | ||
<div className={styles.navbarItem}> | ||
<IconHamburgerLanding onClick={() => setIsNavbarOpen(!navbarOpen)} /> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{/* Expanded Navbar for small view */} | ||
{navbarOpen && smallView && ( | ||
<div className={styles.navContainer}> | ||
{NAVBAR_ITEMS.map((item, index) => ( | ||
<div | ||
key={index} | ||
className={item.name === 'Home' ? styles.navItemHome : styles.navItem} | ||
onClick={() => navigateLink(item)} | ||
> | ||
{item.name} | ||
</div> | ||
))} | ||
<div className={styles.ctaContainer}> | ||
<div className={styles.startBuildingCTA} onClick={startBuilding}> | ||
Start building | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default Navbar; | ||
export default Navbar |
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