generated from kubefirst/react-app-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: image repository * fix: feedback * feat: domaing dns provider * fix: reset form issue * feat: pagination * feat: git auth * feat: git auth response * fix: subgroups validation * feat: image repository * fix: feedback * feat: domaing dns provider * fix: reset form issue * feat: pagination * feat: git auth * feat: git auth response * fix: subgroups validation * fix: ecr default value * fix: org pagination
- Loading branch information
1 parent
05514f4
commit 6659487
Showing
26 changed files
with
416 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import { FormControlLabel, FormGroup, Radio, RadioGroup } from '@mui/material'; | ||
import { Control, Controller, UseControllerProps, FieldValues } from 'react-hook-form'; | ||
|
||
import { VOLCANIC_SAND } from '../../constants/colors'; | ||
import Typography from '../typography'; | ||
|
||
export interface ControlledTextFieldProps<T extends FieldValues> extends UseControllerProps<T> { | ||
control: Control<T>; | ||
required?: boolean; | ||
rules: { | ||
required: boolean; | ||
pattern?: RegExp; | ||
}; | ||
options: Array<{ label: string; value: string }>; | ||
} | ||
|
||
function ControlledRadio<T extends FieldValues>({ | ||
defaultValue, | ||
name, | ||
options, | ||
required, | ||
...props | ||
}: ControlledTextFieldProps<T>) { | ||
return ( | ||
<Controller | ||
{...props} | ||
name={name} | ||
render={({ field }) => ( | ||
<FormGroup> | ||
<RadioGroup defaultValue={defaultValue} name={name}> | ||
{options.map(({ label, value }) => ( | ||
<FormControlLabel | ||
key={label} | ||
value={value} | ||
control={ | ||
<Radio | ||
{...field} | ||
name={name} | ||
required={required} | ||
inputRef={field.ref} | ||
value={value} | ||
onChange={(e) => { | ||
field.onChange(e); | ||
}} | ||
/> | ||
} | ||
label={ | ||
<Typography variant="body2" color={VOLCANIC_SAND}> | ||
{label} | ||
</Typography> | ||
} | ||
/> | ||
))} | ||
</RadioGroup> | ||
</FormGroup> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
export default ControlledRadio; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.