-
Notifications
You must be signed in to change notification settings - Fork 256
Enhance Gate app's SignUp component to support SELECT inputs
#767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ import { | |
| ColorSchemeImage, | ||
| IconButton, | ||
| InputAdornment, | ||
| Select, | ||
| MenuItem, | ||
| } from '@wso2/oxygen-ui'; | ||
| import {SignUp} from '@asgardeo/react'; | ||
| import {Smartphone, Google, Facebook, GitHub, Eye, EyeClosed} from '@wso2/oxygen-ui-icons-react'; | ||
|
|
@@ -128,7 +130,7 @@ export default function SignUpBox(): JSX.Element { | |
| const inputs: Record<string, string> = {}; | ||
|
|
||
| form.components | ||
| ?.filter((c: {type: string}) => c.type === 'INPUT') | ||
| ?.filter((c: {type: string}) => c.type === 'INPUT' || c.type === 'SELECT') | ||
| .forEach((input: {config: {identifier: string}}) => { | ||
| if (input.config?.identifier) { | ||
| inputs[input.config.identifier] = data.get(input.config.identifier) as string; | ||
|
|
@@ -154,9 +156,50 @@ export default function SignUpBox(): JSX.Element { | |
| required: boolean; | ||
| hint: string; | ||
| text: string; | ||
| options?: string[]; | ||
| }; | ||
| variant: string; | ||
| }) => { | ||
| if (component.type === 'SELECT' && component.config?.options) { | ||
| return ( | ||
| <FormControl key={component.id} fullWidth> | ||
| <FormLabel htmlFor={component.config?.identifier}> | ||
| {component.config?.label} | ||
| </FormLabel> | ||
| <Select | ||
| displayEmpty | ||
| size="small" | ||
| id={component.config?.identifier} | ||
| name={component.config?.identifier} | ||
| required={component.config?.required} | ||
| fullWidth | ||
| disabled={isLoading} | ||
| error={!!errors[component.config?.identifier]} | ||
| defaultValue="" | ||
| > | ||
| <MenuItem value="" disabled> | ||
| {component.config?.placeholder || 'Select an option'} | ||
| </MenuItem> | ||
|
Comment on lines
+178
to
+182
|
||
| {component.config.options.map((option: string) => ( | ||
| <MenuItem key={option} value={option}> | ||
| {option} | ||
| </MenuItem> | ||
| ))} | ||
| </Select> | ||
| {errors[component.config?.identifier] && ( | ||
| <Typography variant="caption" color="error.main" sx={{mt: 0.5}}> | ||
| {errors[component.config?.identifier]} | ||
| </Typography> | ||
| )} | ||
|
Comment on lines
+189
to
+193
|
||
| {component.config?.hint && ( | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {component.config.hint} | ||
| </Typography> | ||
| )} | ||
| </FormControl> | ||
| ); | ||
| } | ||
|
|
||
| if (component.type === 'INPUT') { | ||
| const isPasswordField: boolean = component.config?.type === 'password'; | ||
| const showPassword: boolean = | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Selectcomponent is missing thelabelIdprop which should reference theFormLabel. This is important for proper accessibility and semantic HTML structure. TheFormLabelshould also have anidattribute that matches thelabelIdprop of theSelect.Consider updating the code as follows: