diff options
| author | Sam Nystrom <sam@samnystrom.dev> | 2024-03-13 12:43:43 +0000 |
|---|---|---|
| committer | Sam Nystrom <sam@samnystrom.dev> | 2024-03-13 20:17:07 -0400 |
| commit | cc0fbd8e07c3d85400eaecbb2d4498d7108d3119 (patch) | |
| tree | 00d8a80189fb2590afa7410bc9c2a37cd11df44f /src/pages/ProjectsList.tsx | |
| parent | 2e39671e683f2fdf5a94dafe8d49c4c5befa38c8 (diff) | |
feat: use different header actions for each page
Diffstat (limited to 'src/pages/ProjectsList.tsx')
| -rw-r--r-- | src/pages/ProjectsList.tsx | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/pages/ProjectsList.tsx b/src/pages/ProjectsList.tsx index d548aa7..324c9bd 100644 --- a/src/pages/ProjectsList.tsx +++ b/src/pages/ProjectsList.tsx @@ -2,7 +2,8 @@ import { useContext, useEffect } from 'preact/hooks'; import { useSignal } from '@preact/signals'; import { route } from 'preact-router'; import { Pb } from '../context.ts'; -import { TextInput, Button, Form, FormLabel, ContainedList, Content } from '../components'; +import { logOut } from '../util.ts'; +import { Header, Content, ContainedList, Form, FormLabel, TextInput, Button } from '../components'; const ProjectsList = ({ user }) => { console.log(user); @@ -25,27 +26,31 @@ const ProjectsList = ({ user }) => { route(`/${user}/${project.name}`); }; - if (projects.value === null) { - return ( - <p>Loading...</p> - ); - } return ( - <Content> - <h1>{user}'s Projects</h1> - <Form onSubmit={onCreateProject}> - <FormLabel> - Name - <TextInput placeholder="Project name" signal={projectName} /> - </FormLabel> - <Button>Create project</Button> - </Form> - <ContainedList> - {projects.value.items.map(p => ( - <li><Button kind="ghost" href={`/${user}/${p.name}`}>{p.name}</Button></li> - ))} - </ContainedList> - </Content> + <> + <Header> + <Button kind="ghost" href="/account">My Account</Button> + <Button kind="ghost" onClick={() => logOut(pb)}>Log Out</Button> + </Header> + <Content> + <h1>{user}'s Projects</h1> + <Form onSubmit={onCreateProject}> + <FormLabel> + Name + <TextInput placeholder="Project name" signal={projectName} /> + </FormLabel> + <Button>Create project</Button> + </Form> + {projects.value === null + ? <p>Loading...</p> + : <ContainedList> + {projects.value.items.map(p => ( + <li><Button kind="ghost" href={`/${user}/${p.name}`}>{p.name}</Button></li> + ))} + </ContainedList> + } + </Content> + </> ); }; |
