-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.tsx
More file actions
34 lines (32 loc) · 1.07 KB
/
form.tsx
File metadata and controls
34 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { GitRepository } from "mobx-github";
import { i18n, topicStore } from "@/models/example";
import { Field } from "@/registry/new-york/blocks/rest-form/rest-form";
import { SearchableInput } from "@/registry/new-york/blocks/searchable-input/searchable-input";
export const fields: Field<GitRepository>[] = [
{
key: "full_name",
renderLabel: "Repository Name",
required: true,
minLength: 3,
invalidMessage: "Input 3 characters at least",
},
{ key: "homepage", type: "url", renderLabel: "Home Page" },
{ key: "language", renderLabel: "Programming Language" },
{
key: "topics",
renderLabel: "Topic",
renderInput: ({ topics }) => (
<SearchableInput
translator={i18n}
store={topicStore}
labelKey="name"
valueKey="name"
placeholder="search GitHub topics"
multiple
defaultValue={topics?.map((value) => ({ value, label: value }))}
/>
),
},
{ key: "stargazers_count", type: "number", renderLabel: "Star Count" },
{ key: "description", renderLabel: "Description", rows: 3 },
];