New: Demo Homepage

This commit is contained in:
Konstantin Hintermayer 2024-10-03 22:55:03 +02:00
parent e6ec877864
commit 7c21d11e8d
4 changed files with 51 additions and 1 deletions

View File

@ -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>
)

View 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 = {}

View 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()
})
})

View 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