refactor: add missing props to generic components (#325)
* refactor: add missing props to generic components * fix: remove undefined from variant Co-authored-by: Vojtech Simetka <vojtech@simetka.cz> Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>
This commit is contained in:
@@ -10,6 +10,7 @@ interface Props {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
cancel?: boolean
|
cancel?: boolean
|
||||||
|
variant?: 'text' | 'contained' | 'outlined'
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles(() =>
|
||||||
@@ -49,6 +50,7 @@ export function SwarmButton({
|
|||||||
disabled,
|
disabled,
|
||||||
loading,
|
loading,
|
||||||
cancel,
|
cancel,
|
||||||
|
variant = 'contained',
|
||||||
}: Props): ReactElement {
|
}: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ export function SwarmButton({
|
|||||||
onClick()
|
onClick()
|
||||||
event.currentTarget.blur()
|
event.currentTarget.blur()
|
||||||
}}
|
}}
|
||||||
variant="contained"
|
variant={variant}
|
||||||
startIcon={icon}
|
startIcon={icon}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface Props {
|
|||||||
password?: boolean
|
password?: boolean
|
||||||
formik?: boolean
|
formik?: boolean
|
||||||
optional?: boolean
|
optional?: boolean
|
||||||
|
defaultValue?: string
|
||||||
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
|
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +33,15 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export function SwarmTextInput({ name, label, password, optional, formik, onChange }: Props): ReactElement {
|
export function SwarmTextInput({
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
password,
|
||||||
|
optional,
|
||||||
|
formik,
|
||||||
|
onChange,
|
||||||
|
defaultValue,
|
||||||
|
}: Props): ReactElement {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
if (formik) {
|
if (formik) {
|
||||||
@@ -46,7 +55,7 @@ export function SwarmTextInput({ name, label, password, optional, formik, onChan
|
|||||||
fullWidth
|
fullWidth
|
||||||
variant="filled"
|
variant="filled"
|
||||||
className={classes.field}
|
className={classes.field}
|
||||||
defaultValue=""
|
defaultValue={defaultValue || ''}
|
||||||
InputProps={{ disableUnderline: true }}
|
InputProps={{ disableUnderline: true }}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -60,7 +69,7 @@ export function SwarmTextInput({ name, label, password, optional, formik, onChan
|
|||||||
fullWidth
|
fullWidth
|
||||||
variant="filled"
|
variant="filled"
|
||||||
className={classes.field}
|
className={classes.field}
|
||||||
defaultValue=""
|
defaultValue={defaultValue || ''}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
InputProps={{ disableUnderline: true }}
|
InputProps={{ disableUnderline: true }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user