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>
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
import { createStyles, FormHelperText, makeStyles, MenuItem, Select as SimpleSelect, Theme } from '@material-ui/core'
|
||||
import { Field } from 'formik'
|
||||
import { Select } from 'formik-material-ui'
|
||||
import { ReactElement } from 'react'
|
||||
|
||||
export type SelectEvent = React.ChangeEvent<{
|
||||
name?: string | undefined
|
||||
value: unknown
|
||||
}>
|
||||
|
||||
interface Props {
|
||||
label?: string
|
||||
name?: string
|
||||
options: { value: string; label: string }[]
|
||||
onChange?: (event: SelectEvent) => void
|
||||
formik?: boolean
|
||||
defaultValue?: string
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
select: {
|
||||
borderRadius: 0,
|
||||
background: theme.palette.background.paper,
|
||||
'& fieldset': {
|
||||
border: 0,
|
||||
},
|
||||
},
|
||||
option: {
|
||||
height: '52px',
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
export function SwarmSelect({ defaultValue, formik, name, options, onChange, label }: Props): ReactElement {
|
||||
const classes = useStyles()
|
||||
|
||||
if (formik) {
|
||||
return (
|
||||
<>
|
||||
{label && <FormHelperText>{label}</FormHelperText>}
|
||||
<Field
|
||||
required
|
||||
component={Select}
|
||||
name={name}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
defaultValue={defaultValue || ''}
|
||||
className={classes.select}
|
||||
placeholder={label}
|
||||
>
|
||||
{options.map((x, i) => (
|
||||
<MenuItem key={i} value={x.value} className={classes.option}>
|
||||
{x.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Field>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{label && <FormHelperText>{label}</FormHelperText>}
|
||||
<SimpleSelect
|
||||
required
|
||||
name={name}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
className={classes.select}
|
||||
defaultValue={defaultValue || ''}
|
||||
onChange={onChange}
|
||||
placeholder={label}
|
||||
>
|
||||
{options.map((x, i) => (
|
||||
<MenuItem key={i} value={x.value} className={classes.option}>
|
||||
{x.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</SimpleSelect>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user