mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
fix: header dropdown item might not be linkable
This commit is contained in:
@@ -13,7 +13,7 @@ export interface IHeaderListItemAttrs extends ComponentAttrs {
|
|||||||
content: string;
|
content: string;
|
||||||
excerpt: string;
|
excerpt: string;
|
||||||
datetime?: Date;
|
datetime?: Date;
|
||||||
href: string;
|
href?: string | null;
|
||||||
onclick?: (e: Event) => void;
|
onclick?: (e: Event) => void;
|
||||||
actions?: Mithril.Children;
|
actions?: Mithril.Children;
|
||||||
}
|
}
|
||||||
@@ -22,8 +22,18 @@ export default class HeaderListItem<CustomAttrs extends IHeaderListItemAttrs = I
|
|||||||
view(vnode: Mithril.Vnode<CustomAttrs, this>) {
|
view(vnode: Mithril.Vnode<CustomAttrs, this>) {
|
||||||
const { avatar, icon: iconName, content, excerpt, datetime, href, className, onclick, actions, ...attrs } = vnode.attrs;
|
const { avatar, icon: iconName, content, excerpt, datetime, href, className, onclick, actions, ...attrs } = vnode.attrs;
|
||||||
|
|
||||||
|
const Tag = href ? Link : 'button';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link className={classList('HeaderListItem', className)} href={href} external={href.includes('://')} onclick={onclick}>
|
<Tag
|
||||||
|
className={classList('HeaderListItem', className, {
|
||||||
|
'Button--ua-reset': Tag === 'button',
|
||||||
|
})}
|
||||||
|
href={href}
|
||||||
|
external={href?.includes('://')}
|
||||||
|
onclick={onclick}
|
||||||
|
{...attrs}
|
||||||
|
>
|
||||||
{avatar}
|
{avatar}
|
||||||
<Icon name={iconName} className="HeaderListItem-icon" />
|
<Icon name={iconName} className="HeaderListItem-icon" />
|
||||||
<span className="HeaderListItem-title">
|
<span className="HeaderListItem-title">
|
||||||
@@ -33,7 +43,7 @@ export default class HeaderListItem<CustomAttrs extends IHeaderListItemAttrs = I
|
|||||||
</span>
|
</span>
|
||||||
<div className="HeaderListItem-actions">{actions}</div>
|
<div className="HeaderListItem-actions">{actions}</div>
|
||||||
<div className="HeaderListItem-excerpt">{excerpt}</div>
|
<div className="HeaderListItem-excerpt">{excerpt}</div>
|
||||||
</Link>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -168,6 +168,7 @@
|
|||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
row-gap: 1px;
|
row-gap: 1px;
|
||||||
column-gap: 6px;
|
column-gap: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
// Prevent outline overflowing parent
|
// Prevent outline overflowing parent
|
||||||
.add-keyboard-focus-ring-offset(-1px);
|
.add-keyboard-focus-ring-offset(-1px);
|
||||||
|
Reference in New Issue
Block a user