Skip to content

Commit

Permalink
feat: adds a login page
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 committed Nov 30, 2023
1 parent fc7b885 commit 0851dc2
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="/login" page={LoginPage} name="login" />
<Route path="/dashboard" page={DashboardPage} name="dashboard" />
<Route notfound page={NotFoundPage} />
</Router>
Expand Down
13 changes: 13 additions & 0 deletions web/src/pages/LoginPage/LoginPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/react'

import LoginPage from './LoginPage'

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

export default meta

type Story = StoryObj<typeof LoginPage>

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

import LoginPage from './LoginPage'

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

describe('LoginPage', () => {
it('renders successfully', () => {
expect(() => {
render(<LoginPage />)
}).not.toThrow()
})
})
21 changes: 21 additions & 0 deletions web/src/pages/LoginPage/LoginPage.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 LoginPage = () => {
return (
<>
<MetaTags title="Login" description="Login page" />

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

export default LoginPage

0 comments on commit 0851dc2

Please sign in to comment.