Files
bee-dashboard/src/components/SwarmTextInput.tsx
T
Cafe137 25b65c3fb7 feat: add identity and feed management (#272)
* feat(wip): add basic feed operations

* ci: bump checks

* ci: bump checks

* feat: rework stamps and add feed functionalities

* refactor: polish and fixes

* feat(wip): add formulas

* feat: show bzz.link for websites

* feat: add stamp empty states and formatBzz

* feat: add feed download

* chore: update manifest-js version

* feat: dev mode support with bee-js 3.1.0 (#273)

* feat: dev mode support with bee-js 3.1.0

* fix: added missing package-lock.json file

* build: remove PR preview

* style: work on design

* feat: add TroubleshootConnectionCard

* build: remove depcheck

Co-authored-by: Attila Gazso <agazso@gmail.com>
2021-12-21 10:58:54 +01:00

59 lines
1.3 KiB
TypeScript

import { createStyles, makeStyles, TextField as SimpleTextField, Theme } from '@material-ui/core'
import { Field } from 'formik'
import { TextField } from 'formik-material-ui'
import { ChangeEvent, ReactElement } from 'react'
interface Props {
name: string
label: string
password?: boolean
formik?: boolean
optional?: boolean
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void
}
const useStyles = makeStyles((theme: Theme) =>
createStyles({
field: {
background: theme.palette.background.paper,
height: '52px',
'& fieldset': {
border: 0,
},
},
}),
)
export function SwarmTextInput({ name, label, password, optional, formik, onChange }: Props): ReactElement {
const classes = useStyles()
if (formik) {
return (
<Field
component={TextField}
type={password ? 'password' : undefined}
required={!optional}
name={name}
label={label}
fullWidth
variant="outlined"
className={classes.field}
defaultValue=""
/>
)
}
return (
<SimpleTextField
type={password ? 'password' : undefined}
required
label={label}
fullWidth
variant="outlined"
className={classes.field}
defaultValue=""
onChange={onChange}
/>
)
}