diff --git a/web/src/Routes.tsx b/web/src/Routes.tsx index 0291fd9..5a60174 100644 --- a/web/src/Routes.tsx +++ b/web/src/Routes.tsx @@ -7,12 +7,17 @@ // 'src/pages/HomePage/HomePage.js' -> HomePage // 'src/pages/Admin/BooksPage/BooksPage.js' -> AdminBooksPage -import { Router, Route } from '@redwoodjs/router' +import { Router, Route, Set } from '@redwoodjs/router' + +import NavbarLayout from './layouts/NavbarLayout/NavbarLayout' const Routes = () => { return ( - + + + + ) diff --git a/web/src/layouts/NavbarLayout/NavbarLayout.stories.tsx b/web/src/layouts/NavbarLayout/NavbarLayout.stories.tsx new file mode 100644 index 0000000..d62073c --- /dev/null +++ b/web/src/layouts/NavbarLayout/NavbarLayout.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta, StoryObj } from '@storybook/react' + +import NavbarLayout from './NavbarLayout' + +const meta: Meta = { + component: NavbarLayout, +} + +export default meta + +type Story = StoryObj + +export const Primary: Story = {} diff --git a/web/src/layouts/NavbarLayout/NavbarLayout.test.tsx b/web/src/layouts/NavbarLayout/NavbarLayout.test.tsx new file mode 100644 index 0000000..8acb00b --- /dev/null +++ b/web/src/layouts/NavbarLayout/NavbarLayout.test.tsx @@ -0,0 +1,14 @@ +import { render } from '@redwoodjs/testing/web' + +import NavbarLayout from './NavbarLayout' + +// Improve this test with help from the Redwood Testing Doc: +// https://redwoodjs.com/docs/testing#testing-pages-layouts + +describe('NavbarLayout', () => { + it('renders successfully', () => { + expect(() => { + render() + }).not.toThrow() + }) +}) diff --git a/web/src/layouts/NavbarLayout/NavbarLayout.tsx b/web/src/layouts/NavbarLayout/NavbarLayout.tsx new file mode 100644 index 0000000..9f62814 --- /dev/null +++ b/web/src/layouts/NavbarLayout/NavbarLayout.tsx @@ -0,0 +1,85 @@ +import { mdiMenu } from '@mdi/js' +import Icon from '@mdi/react' + +import { Link, routes } from '@redwoodjs/router' + +import ThemeToggle from 'src/components/ThemeToggle/ThemeToggle' + +interface NavbarRoute { + name: string + path: string +} + +type NavbarLayoutProps = { + children?: React.ReactNode +} + +const NavbarLayout = ({ children }: NavbarLayoutProps) => { + // TODO: populate with buttons to other page + const navbarRoutes: NavbarRoute[] = [ + { + name: 'Test', + path: routes.home(), + }, + ] + + const navbarButtons = () => + navbarRoutes.map((route, i) => ( + + {route.name} + + )) + + return ( + <> +
+
+
+
+
+ +
+
+ {navbarButtons()} +
+
+ + Ahmed Al-Taiar + +
+
+ + Ahmed Al-Taiar + +
+
+
{navbarButtons()}
+
+
+ +
+
+
+
{children}
+ + ) +} + +export default NavbarLayout