|
6 | 6 | Checkbox,
|
7 | 7 | CircularProgress,
|
8 | 8 | Flexbox,
|
| 9 | + Form, |
9 | 10 | Icon,
|
10 | 11 | IconButton,
|
11 | 12 | Image,
|
@@ -101,16 +102,6 @@ export const App: React.FC = () => {
|
101 | 102 | const [isPlayButtonActivated, setIsPlayButtonActivated] = useState(false)
|
102 | 103 | const [isPlayButton2Activated, setIsPlayButton2Activated] = useState(false)
|
103 | 104 |
|
104 |
| - const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => { |
105 |
| - e.preventDefault() |
106 |
| - |
107 |
| - // get form value |
108 |
| - const form = e.currentTarget |
109 |
| - const formData = new FormData(form) |
110 |
| - const data = Object.fromEntries(formData) |
111 |
| - console.log(data) |
112 |
| - } |
113 |
| - |
114 | 105 | return (
|
115 | 106 | <>
|
116 | 107 | <Section title="Button">
|
@@ -285,6 +276,50 @@ export const App: React.FC = () => {
|
285 | 276 | </Flexbox>
|
286 | 277 | </WidgetWrapper>
|
287 | 278 | </Section>
|
| 279 | + <Section title="Form"> |
| 280 | + <WidgetWrapper> |
| 281 | + <Form |
| 282 | + onSubmit={(data) => { |
| 283 | + alert(JSON.stringify(data)) |
| 284 | + }} |
| 285 | + > |
| 286 | + <Flexbox gap="xl"> |
| 287 | + <TextInput name="username" placeholder="Enter your username..." /> |
| 288 | + <TextInput |
| 289 | + name="password" |
| 290 | + placeholder="Enter your password..." |
| 291 | + type="password" |
| 292 | + /> |
| 293 | + <Switch name="notification" label="Enable notifications" /> |
| 294 | + <RadioGroup defaultValue="lemon"> |
| 295 | + <Flexbox gap="md"> |
| 296 | + <Radio label="Strawberry" name="fruit" value="strawberry" /> |
| 297 | + <Radio label="Apple" name="fruit" value="apple" /> |
| 298 | + <Radio label="Lemon" name="fruit" value="lemon" /> |
| 299 | + </Flexbox> |
| 300 | + </RadioGroup> |
| 301 | + <Select |
| 302 | + name="language" |
| 303 | + placeholder="Your favorite programming language" |
| 304 | + > |
| 305 | + <SelectOption value="javascript" label="JavaScript" /> |
| 306 | + <SelectOption value="python" label="Python" /> |
| 307 | + <SelectOption value="java" label="Java" /> |
| 308 | + <SelectOption value="csharp" label="C#" /> |
| 309 | + <SelectOption value="c++" label="C++" /> |
| 310 | + <SelectOption value="ruby" label="Ruby" /> |
| 311 | + </Select> |
| 312 | + <Checkbox |
| 313 | + name="terms" |
| 314 | + label="I agree to the terms and conditions" |
| 315 | + checked={false} |
| 316 | + value="terms" |
| 317 | + /> |
| 318 | + <Button type="submit">Submit</Button> |
| 319 | + </Flexbox> |
| 320 | + </Form> |
| 321 | + </WidgetWrapper> |
| 322 | + </Section> |
288 | 323 | <Section title="Icon">
|
289 | 324 | <WidgetWrapper>
|
290 | 325 | <Flexbox alignItems="center" gap="xs" flexDirection="row">
|
@@ -900,28 +935,26 @@ export const App: React.FC = () => {
|
900 | 935 | <Section title="Select">
|
901 | 936 | <WidgetWrapper>
|
902 | 937 | <Flexbox gap="md">
|
903 |
| - <form onSubmit={handleSubmit}> |
904 |
| - <Select |
905 |
| - name="llm" |
906 |
| - placeholder="Choose your LLM solution right now!!" |
907 |
| - onChange={(details) => console.log('Selected', details)} |
908 |
| - > |
909 |
| - <SelectOption value="gpt-4" label="GPT-4" /> |
910 |
| - <SelectOption value="gpt-3.5" label="GPT-3.5" /> |
911 |
| - <SelectOption value="claude" label="Claude" /> |
912 |
| - <SelectOption value="falcon-7b" label="Falcon-7B" /> |
913 |
| - <SelectOption value="mpt-7b" label="MPT-7B" disabled /> |
914 |
| - <SelectOption value="dolly-v2-3b" label="Dolly-v2-3B" /> |
915 |
| - </Select> |
916 |
| - <Button type="submit">Go!</Button> |
917 |
| - <Select |
918 |
| - name="llm-2" |
919 |
| - placeholder="Choose your LLM solution" |
920 |
| - disabled |
921 |
| - > |
922 |
| - ... |
923 |
| - </Select> |
924 |
| - </form> |
| 938 | + <Select |
| 939 | + name="llm" |
| 940 | + placeholder="Choose your LLM solution" |
| 941 | + onChange={(details) => console.log('Selected', details)} |
| 942 | + > |
| 943 | + <SelectOption value="gpt-4" label="GPT-4" /> |
| 944 | + <SelectOption value="gpt-3.5" label="GPT-3.5" /> |
| 945 | + <SelectOption value="claude" label="Claude" /> |
| 946 | + <SelectOption value="falcon-7b" label="Falcon-7B" /> |
| 947 | + <SelectOption value="mpt-7b" label="MPT-7B" disabled /> |
| 948 | + <SelectOption value="dolly-v2-3b" label="Dolly-v2-3B" /> |
| 949 | + </Select> |
| 950 | + <Button type="submit">Go!</Button> |
| 951 | + <Select |
| 952 | + name="llm-2" |
| 953 | + placeholder="Choose your LLM solution" |
| 954 | + disabled |
| 955 | + > |
| 956 | + ... |
| 957 | + </Select> |
925 | 958 | </Flexbox>
|
926 | 959 | </WidgetWrapper>
|
927 | 960 | </Section>
|
|
0 commit comments