-
Notifications
You must be signed in to change notification settings - Fork 1
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 #7 from leslieyip02/add-navbar
Add navigation bar
- Loading branch information
Showing
19 changed files
with
197 additions
and
92 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,4 +1,5 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); | ||
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:[email protected]&family=Lexend&family=Quicksand&display=swap'); | ||
|
||
@tailwind base; | ||
@tailwind components; | ||
|
@@ -7,8 +8,8 @@ | |
|
||
html, body { | ||
font-family: 'Montserrat', sans-serif; | ||
background-color: #4a69bd; | ||
color: #ffffff; | ||
/* background-color: #4a69bd; */ | ||
/* color: #ffffff; */ | ||
} | ||
|
||
a { | ||
|
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,13 @@ | ||
.navigation-bar { | ||
@apply | ||
fixed | ||
flex | ||
items-center | ||
justify-between | ||
w-full | ||
px-8 | ||
md:px-20 | ||
py-4 | ||
bg-white | ||
; | ||
} |
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 { Link } from 'react-router-dom'; | ||
import NavigationMenu from './NavigationMenu'; | ||
import './NavigationBar.css'; | ||
|
||
function NavigationBar() { | ||
return ( | ||
<header className='w-full h-20'> | ||
<div className='navigation-bar'> | ||
<Link to='/'> | ||
<img src='comclub_logo.png' className='h-12 p-2'></img> | ||
</Link> | ||
<NavigationMenu /> | ||
</div> | ||
</header> | ||
); | ||
} | ||
|
||
export default NavigationBar; |
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,38 @@ | ||
.navigation-menu-container { | ||
@apply | ||
flex-initial | ||
flex-row | ||
space-x-8 | ||
justify-between | ||
items-center | ||
text-xl | ||
hidden | ||
md:block | ||
; | ||
} | ||
|
||
.navigation-menu-icon { | ||
@apply | ||
object-contain | ||
cursor-pointer | ||
p-1 | ||
text-primary | ||
hover:rounded-3xl | ||
hover:bg-gray-100 | ||
; | ||
} | ||
|
||
.navigation-menu-dropdown { | ||
@apply | ||
absolute | ||
top-12 | ||
right-0 | ||
flex | ||
flex-col | ||
rounded-md | ||
ring-1 | ||
ring-outline/5 | ||
bg-white | ||
shadow-lg | ||
; | ||
} |
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,61 @@ | ||
import { useState } from 'react'; | ||
import { IoMenu, IoClose } from 'react-icons/io5'; | ||
import NavigationMenuItem from './NavigationMenuItem'; | ||
import './NavigationMenu.css'; | ||
|
||
function NavigationMenu() { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const navigationLinks = { | ||
'Home': '/', | ||
'About': '/about', | ||
'Events': '/events', | ||
'Resources': '/resources', | ||
'Photos': '/photos', | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className='navigation-menu-container'> | ||
{ | ||
Object.entries(navigationLinks) | ||
.map(([label, link], key) => { | ||
return <NavigationMenuItem | ||
label={label} | ||
link={link} | ||
key={key} | ||
/>; | ||
}) | ||
} | ||
</div> | ||
|
||
<div className='md:hidden relative'> | ||
<div | ||
className='navigation-menu-icon' | ||
onClick={() => setIsOpen(!isOpen)} | ||
> | ||
{ | ||
!isOpen | ||
? <IoMenu className='h-10 w-auto' /> | ||
: <IoClose className='h-10 w-auto' /> | ||
} | ||
</div> | ||
<div className={`navigation-menu-dropdown ${!isOpen ? 'hidden' : ''}`}> | ||
{ | ||
Object.entries(navigationLinks) | ||
.map(([label, link], key) => { | ||
return <NavigationMenuItem | ||
label={label} | ||
link={link} | ||
dropdown={true} | ||
key={key} | ||
/>; | ||
}) | ||
} | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default NavigationMenu; |
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,13 @@ | ||
.navigation-menu-item { | ||
@apply | ||
relative | ||
font-heading | ||
p-4 | ||
md:px-0 | ||
text-black | ||
hover:scale-[1.1] | ||
hover:rounded-md | ||
hover:bg-gray-100 | ||
md:hover:bg-transparent | ||
; | ||
} |
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,25 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import './NavigationMenuItem.css'; | ||
|
||
interface NavigationMenuItemProps { | ||
link: string; | ||
label: string; | ||
dropdown: boolean; | ||
} | ||
|
||
function NavigationMenuItem(props: NavigationMenuItemProps) { | ||
return ( | ||
<Link | ||
to={props.link} | ||
className={` | ||
navigation-menu-item | ||
${props.dropdown ? 'p-4 hover:rounded-md hover:bg-gray-100' : ''} | ||
`} | ||
> | ||
{props.label} | ||
</Link> | ||
); | ||
} | ||
|
||
export default NavigationMenuItem; |
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