diff options
author | 2023-07-26 19:58:46 -0600 | |
---|---|---|
committer | 2023-07-27 15:14:11 +0530 | |
commit | 998d229d2978ea4418cb5dab3390b8901f0c2cb3 (patch) | |
tree | 3f0932493d4e6cdd24d50fb407c5eda913b3a360 /src/components/ui/Radio.tsx | |
parent | 6.4.1-nightly.13 [skip ci] (diff) | |
download | ferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.tar.gz ferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.tar.zst ferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.zip |
chore: upgrade mobx-react-form to latest
- upgrade mobx-react-form from v3 to v6
- remove stub mobx-react-form.d.ts since the dependency is written in TS now
- remove as any cast for new Form invocation in invite.tsx
- reuse Error component in Radio.tsx to get validation error message in red
- use FieldInterface type for field property instead of typeof Field in Radio.tsx
Diffstat (limited to 'src/components/ui/Radio.tsx')
-rw-r--r-- | src/components/ui/Radio.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/components/ui/Radio.tsx b/src/components/ui/Radio.tsx index b5be64c5d..1f41deedc 100644 --- a/src/components/ui/Radio.tsx +++ b/src/components/ui/Radio.tsx | |||
@@ -1,10 +1,11 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import { Field } from 'mobx-react-form'; | ||
4 | import classnames from 'classnames'; | 3 | import classnames from 'classnames'; |
4 | import FieldInterface from 'mobx-react-form/lib/models/FieldInterface'; | ||
5 | import Error from './error'; | ||
5 | 6 | ||
6 | type Props = { | 7 | type Props = { |
7 | field: typeof Field; | 8 | field: FieldInterface; |
8 | className: string; | 9 | className: string; |
9 | focus: boolean; | 10 | focus: boolean; |
10 | showLabel: boolean; | 11 | showLabel: boolean; |
@@ -47,7 +48,8 @@ class Radio extends Component<Props> { | |||
47 | </label> | 48 | </label> |
48 | )} | 49 | )} |
49 | <div className="franz-form__radio-wrapper"> | 50 | <div className="franz-form__radio-wrapper"> |
50 | {field.options.map(type => ( | 51 | {/* @ts-expect-error Property 'map' does not exist on type 'OptionsModel'. */} |
52 | {field.options?.map(type => ( | ||
51 | <label | 53 | <label |
52 | key={type.value} | 54 | key={type.value} |
53 | htmlFor={`${field.id}-${type.value}`} | 55 | htmlFor={`${field.id}-${type.value}`} |
@@ -68,7 +70,8 @@ class Radio extends Component<Props> { | |||
68 | </label> | 70 | </label> |
69 | ))} | 71 | ))} |
70 | </div> | 72 | </div> |
71 | {field.error && <div className="franz-form__error">{field.error}</div>} | 73 | |
74 | {field.error && <Error message={field.error} />} | ||
72 | </div> | 75 | </div> |
73 | ); | 76 | ); |
74 | } | 77 | } |