mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
common: fix Button children issue introduced in admin PR
This commit is contained in:
@@ -48,9 +48,8 @@ export interface ButtonProps extends ComponentProps {
|
|||||||
*/
|
*/
|
||||||
export default class Button<T extends ButtonProps = ButtonProps> extends Component<T> {
|
export default class Button<T extends ButtonProps = ButtonProps> extends Component<T> {
|
||||||
view() {
|
view() {
|
||||||
const attrs: T = { ...this.props };
|
const attrs = (({ children, ...o }) => o)(this.props) as T;
|
||||||
|
const children = this.props.children;
|
||||||
const children = extract(attrs, 'children');
|
|
||||||
|
|
||||||
attrs.className = attrs.className || '';
|
attrs.className = attrs.className || '';
|
||||||
attrs.type = attrs.type || 'button';
|
attrs.type = attrs.type || 'button';
|
||||||
@@ -63,7 +62,7 @@ export default class Button<T extends ButtonProps = ButtonProps> extends Compone
|
|||||||
|
|
||||||
// If nothing else is provided, we use the textual button content as tooltip
|
// If nothing else is provided, we use the textual button content as tooltip
|
||||||
if (!attrs.title && children) {
|
if (!attrs.title && children) {
|
||||||
attrs.title = extractText(this.props.children);
|
attrs.title = extractText(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconName = extract(attrs, 'icon');
|
const iconName = extract(attrs, 'icon');
|
||||||
|
Reference in New Issue
Block a user