This commit is contained in:
Daniel Flanagan 2024-01-06 23:53:44 -06:00
parent fc772c62f9
commit 6bff215d4f
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
2 changed files with 18 additions and 15 deletions

13
components/TodoList.tsx Normal file
View file

@ -0,0 +1,13 @@
import { Todo, User } from '$models'
export interface Props {
user: User
}
export function TodoList({ user }: Props) {
return (
<div>
<h1>Todo List for {user}</h1>
</div>
)
}

View file

@ -1,7 +1,7 @@
import { Handlers, PageProps } from '$fresh/server.ts'
import { useSignal } from '@preact/signals'
import Counter from '../islands/Counter.tsx'
import { db, Todo, User } from '$models'
import { TodoList } from '../components/TodoList.tsx'
interface Data {
users: User[]
@ -18,24 +18,14 @@ export const handler: Handlers = {
},
}
export default function Home(props: PageProps<Data>) {
export default function Home(
{ data: { users, unassignedTodos } }: PageProps<Data>,
) {
const count = useSignal(3)
return (
<div class='px-4 py-8 mx-auto bg-emerald-950'>
<div class='max-w-screen-md mx-auto flex flex-col items-center justify-center'>
<img
class='my-6'
src='/logo.svg'
width='128'
height='128'
alt='the Fresh logo: a sliced lemon dripping with juice'
/>
<h1 class='text-4xl font-bold'>Welcome to Fresh</h1>
<p class='my-4'>
Try updating this message in the
<code class='mx-2'>./routes/index.tsx</code> file, and refresh.
</p>
<Counter count={count} />
{users.map((u) => <TodoList user={u} />)}
</div>
</div>
)