feat: notifications rework

This commit is contained in:
Taranto 2020-03-30 13:03:57 +01:00 committed by Josh Harvey
parent b6e7d98b72
commit ffa8713ee4
77 changed files with 2281 additions and 3269 deletions

View file

@ -0,0 +1,69 @@
import MAutocomplete, {
createFilterOptions
} from '@material-ui/lab/Autocomplete'
import * as R from 'ramda'
import React from 'react'
import TextInput from './TextInput'
const Autocomplete = ({
limit = 5,
options,
label,
shouldAdd,
getOptionSelected,
forceShowValue,
value,
onChange,
multiple,
getLabel,
error,
fullWidth,
textAlign,
size,
...props
}) => {
let iOptions = options
const compare = getOptionSelected || R.equals
const find = R.find(it => compare(value, it))
if (forceShowValue && !multiple && value && !find(options)) {
iOptions = R.concat(options, [value])
}
return (
<MAutocomplete
options={iOptions}
multiple={multiple}
value={value}
onChange={onChange}
getOptionLabel={getLabel}
forcePopupIcon={false}
filterOptions={createFilterOptions({ ignoreAccents: true, limit })}
openOnFocus
autoHighlight
disableClearable
ChipProps={{ onDelete: null }}
blurOnSelect
clearOnEscape
getOptionSelected={getOptionSelected}
{...props}
renderInput={params => {
return (
<TextInput
{...params}
label={label}
value={value}
error={error}
size={size}
fullWidth={fullWidth}
textAlign={textAlign}
/>
)
}}
/>
)
}
export default Autocomplete