Skip to content

Commit

Permalink
feat: adds a dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 committed Nov 30, 2023
1 parent ef8d91f commit fc7b885
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions web/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Router, Route } from '@redwoodjs/router'
const Routes = () => {
return (
<Router>
<Route path="/dashboard" page={DashboardPage} name="dashboard" />
<Route notfound page={NotFoundPage} />
</Router>
)
Expand Down
13 changes: 13 additions & 0 deletions web/src/pages/DashboardPage/DashboardPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react'

import DashboardPage from './DashboardPage'

const meta: Meta<typeof DashboardPage> = {
component: DashboardPage,
}

export default meta

type Story = StoryObj<typeof DashboardPage>

export const Primary: Story = {}
14 changes: 14 additions & 0 deletions web/src/pages/DashboardPage/DashboardPage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { render } from '@redwoodjs/testing/web'

import DashboardPage from './DashboardPage'

// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-pages-layouts

describe('DashboardPage', () => {
it('renders successfully', () => {
expect(() => {
render(<DashboardPage />)
}).not.toThrow()
})
})
21 changes: 21 additions & 0 deletions web/src/pages/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Link, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'

const DashboardPage = () => {
return (
<>
<MetaTags title="Dashboard" description="Dashboard page" />

<h1>DashboardPage</h1>
<p>
Find me in <code>./web/src/pages/DashboardPage/DashboardPage.tsx</code>
</p>
<p>
My default route is named <code>dashboard</code>, link to me with `
<Link to={routes.dashboard()}>Dashboard</Link>`
</p>
</>
)
}

export default DashboardPage

0 comments on commit fc7b885

Please sign in to comment.