aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/navbar.tsx27
-rw-r--r--components/navbarItem.tsx14
2 files changed, 27 insertions, 14 deletions
diff --git a/components/navbar.tsx b/components/navbar.tsx
new file mode 100644
index 0000000..bdadfbc
--- /dev/null
+++ b/components/navbar.tsx
@@ -0,0 +1,27 @@
+import { ReactNode } from 'react';
+
+import HomeRoundedIcon from '@material-ui/icons/HomeRounded';
+import SearchRoundedIcon from '@material-ui/icons/SearchRounded';
+
+function NavbarItem(props: {
+ icon?: ReactNode;
+ title: string;
+ href: string;
+ active: boolean;
+}) {
+ return <a href={props.href} className={ "navbarItem" + (props.active ? " active" : "") }>
+ <div>
+ {props.icon}
+ <span>{props.title}</span>
+ </div>
+ </a>
+}
+
+export default function Navbar(props: {
+ page?: string;
+}) {
+ return <div>
+ <NavbarItem active={props.page == "home"} icon={<HomeRoundedIcon/>} title="Home" href="/"/>
+ <NavbarItem active={props.page == "search"} icon={<SearchRoundedIcon/>} title="Search for posts" href="/search"/>
+ </div>
+}
diff --git a/components/navbarItem.tsx b/components/navbarItem.tsx
deleted file mode 100644
index b724444..0000000
--- a/components/navbarItem.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { ReactNode } from 'react';
-
-export default function NavbarItem(props: {
- icon?: ReactNode;
- title: string;
- href: string;
-}) {
- return <a href={props.href} className="navbarItem">
- <div>
- {props.icon}
- <span>{props.title}</span>
- </div>
- </a>
-}