mirror of
https://github.com/flarum/framework.git
synced 2025-02-17 00:02:45 +08:00
fix: empty string displayed as SelectDropdown title (#3773)
* fix: empty string displayed as SelectDropdown title * chore: remove import * chore: ts-ignore * Update framework/core/js/src/common/components/SelectDropdown.tsx Co-authored-by: David Wheatley <david@davwheat.dev> --------- Co-authored-by: David Wheatley <david@davwheat.dev>
This commit is contained in:
parent
85b63681ae
commit
d684248492
|
@ -1,6 +1,5 @@
|
|||
import Dropdown, { IDropdownAttrs } from './Dropdown';
|
||||
import icon from '../helpers/icon';
|
||||
import extractText from '../utils/extractText';
|
||||
import classList from '../utils/classList';
|
||||
import type Component from '../Component';
|
||||
import type Mithril from 'mithril';
|
||||
|
@ -50,7 +49,8 @@ export default class SelectDropdown<CustomAttrs extends ISelectDropdownAttrs = I
|
|||
const activeChild = children.find(isActive);
|
||||
let label = (activeChild && typeof activeChild === 'object' && 'children' in activeChild && activeChild.children) || this.attrs.defaultLabel;
|
||||
|
||||
label = extractText(label);
|
||||
// @ts-ignore
|
||||
if (Array.isArray(label)) label = label[0];
|
||||
|
||||
return [<span className="Button-label">{label}</span>, this.attrs.caretIcon ? icon(this.attrs.caretIcon, { className: 'Button-caret' }) : null];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user