NewRepo.tsx
| 1 | import type { SessionUser } from "../../middleware/session.ts"; |
| 2 | import { Layout } from "../layout.tsx"; |
| 3 | |
| 4 | interface NewRepoProps { |
| 5 | user: SessionUser; |
| 6 | error?: string; |
| 7 | } |
| 8 | |
| 9 | export function NewRepo({ user, error }: NewRepoProps) { |
| 10 | return ( |
| 11 | <Layout user={user} title="New repository"> |
| 12 | <div class="container container-narrow"> |
| 13 | <h1 class="page-title">Create new repository</h1> |
| 14 | {error && <p class="form-error">{error}</p>} |
| 15 | <form method="POST" action="/new" class="form-card"> |
| 16 | <div class="form-group"> |
| 17 | <label for="name">Repository name</label> |
| 18 | <input |
| 19 | id="name" |
| 20 | name="name" |
| 21 | type="text" |
| 22 | required |
| 23 | pattern="[a-zA-Z0-9._-]+" |
| 24 | title="Letters, numbers, dots, hyphens, underscores" |
| 25 | placeholder="my-project" |
| 26 | /> |
| 27 | </div> |
| 28 | <div class="form-group"> |
| 29 | <label for="description"> |
| 30 | Description{" "} |
| 31 | <span class="text-muted">(optional)</span> |
| 32 | </label> |
| 33 | <input |
| 34 | id="description" |
| 35 | name="description" |
| 36 | type="text" |
| 37 | placeholder="A short description" |
| 38 | /> |
| 39 | </div> |
| 40 | <div class="form-group"> |
| 41 | <label for="default_branch">Default branch</label> |
| 42 | <input |
| 43 | id="default_branch" |
| 44 | name="default_branch" |
| 45 | type="text" |
| 46 | value="main" |
| 47 | placeholder="main" |
| 48 | /> |
| 49 | </div> |
| 50 | <div class="form-group"> |
| 51 | <label class="checkbox-label"> |
| 52 | <input |
| 53 | type="checkbox" |
| 54 | name="is_private" |
| 55 | value="1" |
| 56 | /> |
| 57 | Private repository |
| 58 | </label> |
| 59 | </div> |
| 60 | <button type="submit" class="btn btn-primary"> |
| 61 | Create repository |
| 62 | </button> |
| 63 | </form> |
| 64 | </div> |
| 65 | </Layout> |
| 66 | ); |
| 67 | } |
| 68 |