react-params prioritize displayName (#1846)
* constructor index bug * Contract fixes * lint * console * console * prioritize displayName params * linting
This commit is contained in:
parent
8cd84e8f6b
commit
afdc1a243a
@ -72,7 +72,11 @@ const components: ComponentMap = ([
|
||||
export default function findComponent (def: TypeDef, overrides: ComponentMap = {}): React.ComponentType<Props> {
|
||||
const findOne = (type: string): React.ComponentType<Props> | null =>
|
||||
overrides[type] || components[type];
|
||||
const type = (({ info, sub, type }: TypeDef): string => {
|
||||
const type = (({ displayName, info, sub, type }: TypeDef): string => {
|
||||
if (displayName) {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
switch (info) {
|
||||
case TypeDefInfo.Compact:
|
||||
return (sub as TypeDef).type;
|
||||
|
||||
@ -27,8 +27,8 @@ function Param ({ className, defaultValue, isDisabled, isOptional, name, onChang
|
||||
}
|
||||
|
||||
const label = isUndefined(name)
|
||||
? type.type
|
||||
: `${name}: ${type.type}`;
|
||||
? (type.displayName || type.type)
|
||||
: `${name}: ${type.displayName || type.type}`;
|
||||
|
||||
return isOptional
|
||||
? (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user