NewIssue.tsx
| 1 | import type { RepositoryRow } from "../../db/index.ts"; |
| 2 | import type { SessionUser } from "../../middleware/session.ts"; |
| 3 | import { Layout } from "../layout.tsx"; |
| 4 | import { RepoHeader } from "../repos/RepoHeader.tsx"; |
| 5 | import { RepoNav } from "../repos/RepoNav.tsx"; |
| 6 | |
| 7 | interface NewIssueProps { |
| 8 | user: SessionUser; |
| 9 | repo: RepositoryRow; |
| 10 | error?: string; |
| 11 | } |
| 12 | |
| 13 | export function NewIssue({ user, repo, error }: NewIssueProps) { |
| 14 | return ( |
| 15 | <Layout user={user} title={`New issue — ${repo.name}`}> |
| 16 | <div class="container container-narrow"> |
| 17 | <RepoHeader repo={repo} /> |
| 18 | <RepoNav repo={repo} active="issues" user={user} /> |
| 19 | <h2 class="section-title">New issue</h2> |
| 20 | {error && <p class="form-error">{error}</p>} |
| 21 | <form |
| 22 | method="POST" |
| 23 | action={`/${repo.name}/issues`} |
| 24 | class="form-card" |
| 25 | > |
| 26 | <div class="form-group"> |
| 27 | <label for="title">Title</label> |
| 28 | <input |
| 29 | id="title" |
| 30 | name="title" |
| 31 | type="text" |
| 32 | required |
| 33 | placeholder="Short, descriptive title" |
| 34 | /> |
| 35 | </div> |
| 36 | <div class="form-group"> |
| 37 | <label for="body"> |
| 38 | Description{" "} |
| 39 | <span class="text-muted"> |
| 40 | (Markdown supported, optional) |
| 41 | </span> |
| 42 | </label> |
| 43 | <textarea |
| 44 | id="body" |
| 45 | name="body" |
| 46 | rows="10" |
| 47 | placeholder="Describe the issue..." |
| 48 | /> |
| 49 | </div> |
| 50 | <div class="form-actions"> |
| 51 | <button type="submit" class="btn btn-primary"> |
| 52 | Submit issue |
| 53 | </button> |
| 54 | <a href={`/${repo.name}/issues`} class="btn btn-ghost"> |
| 55 | Cancel |
| 56 | </a> |
| 57 | </div> |
| 58 | </form> |
| 59 | </div> |
| 60 | </Layout> |
| 61 | ); |
| 62 | } |
| 63 |