New: Demo Homepage
This commit is contained in:
parent
e6ec877864
commit
7c21d11e8d
|
@ -11,7 +11,7 @@ import { Router, Route } from '@redwoodjs/router'
|
|||
|
||||
const Routes = () => {
|
||||
return (
|
||||
<Router>
|
||||
<Route path="/" page={HomePage} name="home" />
|
||||
<Route notfound page={NotFoundPage} />
|
||||
</Router>
|
||||
)
|
||||
|
|
13
web/src/pages/HomePage/HomePage.stories.tsx
Normal file
13
web/src/pages/HomePage/HomePage.stories.tsx
Normal file
|
@ -0,0 +1,13 @@
|
|||
import type { Meta, StoryObj } from '@storybook/react'
|
||||
|
||||
import HomePage from './HomePage'
|
||||
|
||||
const meta: Meta<typeof HomePage> = {
|
||||
component: HomePage,
|
||||
}
|
||||
|
||||
export default meta
|
||||
|
||||
type Story = StoryObj<typeof HomePage>
|
||||
|
||||
export const Primary: Story = {}
|
14
web/src/pages/HomePage/HomePage.test.tsx
Normal file
14
web/src/pages/HomePage/HomePage.test.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { render } from '@redwoodjs/testing/web'
|
||||
|
||||
import HomePage from './HomePage'
|
||||
|
||||
// Improve this test with help from the Redwood Testing Doc:
|
||||
// https://redwoodjs.com/docs/testing#testing-pages-layouts
|
||||
|
||||
describe('HomePage', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<HomePage />)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
23
web/src/pages/HomePage/HomePage.tsx
Normal file
23
web/src/pages/HomePage/HomePage.tsx
Normal file
|
@ -0,0 +1,23 @@
|
|||
// import { Link, routes } from '@redwoodjs/router'
|
||||
import { Link } from '@redwoodjs/router'
|
||||
import { Metadata } from '@redwoodjs/web'
|
||||
|
||||
const HomePage = () => {
|
||||
return (
|
||||
<>
|
||||
<Metadata title="Home" description="Home page" />
|
||||
|
||||
<h1>HomePage</h1>
|
||||
<p>
|
||||
Find me in <code>./web/src/pages/HomePage/HomePage.tsx</code>
|
||||
</p>
|
||||
{/*
|
||||
My default route is named `home`, link to me with:
|
||||
`<Link to={routes.home()}>Home</Link>`
|
||||
*/}
|
||||
<Link to={'/login'}>Login</Link>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default HomePage
|
Loading…
Reference in New Issue
Block a user