Spaces:
Paused
Paused
Download frontend/src/components/RepoInputBar.tsx from 2Btainment/repospace: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/2Btainment/repospace/resolve/main/frontend/src/components/RepoInputBar.tsx
- Command line
-
hf download hf://spaces/2Btainment/repospace/frontend/src/components/RepoInputBar.tsx
-
curl -L -o RepoInputBar.tsx https://huggingface.co/spaces/2Btainment/repospace/resolve/main/frontend/src/components/RepoInputBar.tsx
1.29 kB
| import { FormEvent } from "react"; | |
| import { t } from "../i18n"; | |
| interface Props { | |
| url: string; | |
| token: string; | |
| busy: boolean; | |
| onUrl: (v: string) => void; | |
| onToken: (v: string) => void; | |
| onSubmit: () => void; | |
| } | |
| export function RepoInputBar({ url, token, busy, onUrl, onToken, onSubmit }: Props) { | |
| const m = t(); | |
| const submit = (e: FormEvent) => { | |
| e.preventDefault(); | |
| if (!busy && url.trim()) onSubmit(); | |
| }; | |
| return ( | |
| <form className="card" onSubmit={submit}> | |
| <div className="row"> | |
| <input | |
| type="text" | |
| value={url} | |
| onChange={(e) => onUrl(e.target.value)} | |
| placeholder={m.urlPlaceholder} | |
| aria-label="GitHub repository URL" | |
| autoComplete="off" | |
| /> | |
| <button type="submit" disabled={busy || !url.trim()}> | |
| {busy ? m.launching : m.launch} | |
| </button> | |
| </div> | |
| <div className="row" style={{ marginTop: ".65rem" }}> | |
| <input | |
| type="password" | |
| value={token} | |
| onChange={(e) => onToken(e.target.value)} | |
| placeholder={m.tokenOptional} | |
| autoComplete="off" | |
| aria-label="GitHub token" | |
| /> | |
| </div> | |
| <div className="hint"> | |
| {m.tokenHint} · {m.noSecrets} | |
| </div> | |
| </form> | |
| ); | |
| } | |