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 && ( |
| 15 | <p class="form-error" safe> |
| 16 | {error} |
| 17 | </p> |
| 18 | )} |
| 19 | <form method="POST" action="/new" class="form-card"> |
| 20 | <div class="form-group"> |
| 21 | <label for="name">Repository name</label> |
| 22 | <input |
| 23 | id="name" |
| 24 | name="name" |
| 25 | type="text" |
| 26 | required |
| 27 | pattern="[a-zA-Z0-9._-]+" |
| 28 | title="Letters, numbers, dots, hyphens, underscores" |
| 29 | placeholder="my-project" |
| 30 | /> |
| 31 | </div> |
| 32 | <div class="form-group"> |
| 33 | <label for="description"> |
| 34 | Description{" "} |
| 35 | <span class="text-muted">(optional)</span> |
| 36 | </label> |
| 37 | <input |
| 38 | id="description" |
| 39 | name="description" |
| 40 | type="text" |
| 41 | placeholder="A short description" |
| 42 | /> |
| 43 | </div> |
| 44 | <div class="form-group"> |
| 45 | <label for="default_branch">Default branch</label> |
| 46 | <input |
| 47 | id="default_branch" |
| 48 | name="default_branch" |
| 49 | type="text" |
| 50 | value="main" |
| 51 | placeholder="main" |
| 52 | /> |
| 53 | </div> |
| 54 | <div class="form-group"> |
| 55 | <label class="checkbox-label"> |
| 56 | <input |
| 57 | type="checkbox" |
| 58 | name="is_private" |
| 59 | value="1" |
| 60 | /> |
| 61 | Private repository (only visible to you) |
| 62 | </label> |
| 63 | </div> |
| 64 | <button type="submit" class="btn btn-primary"> |
| 65 | Create repository |
| 66 | </button> |
| 67 | </form> |
| 68 | </div> |
| 69 | </Layout> |
| 70 | ); |
| 71 | } |
| 72 |