mirror of
https://github.com/flarum/framework.git
synced 2025-03-15 00:05:12 +08:00
change use of classNames
so no arrays/objects are used, just spread arguments
This commit is contained in:
parent
eae6a11719
commit
4f79a05a4b
@ -53,7 +53,7 @@ export default class Button<T extends ButtonProps = ButtonProps> extends Compone
|
||||
|
||||
const loading = extract(attrs, 'loading');
|
||||
if (attrs.disabled || loading) {
|
||||
attrs.className += ' ' + classNames('disabled', loading && 'loading');
|
||||
attrs.className = classNames(attrs.className, 'disabled', loading && 'loading');
|
||||
delete attrs.onclick;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ export default function listItems(items) {
|
||||
item
|
||||
) : (
|
||||
<li
|
||||
className={classNames(className, [item.itemName && `item-${item.itemName}`, active && 'active'])}
|
||||
className={classNames(className, item.itemName && `item-${item.itemName}`, active && 'active')}
|
||||
key={item.attrs?.key || item.itemName}
|
||||
>
|
||||
{item}
|
||||
|
@ -81,16 +81,14 @@ export default class CommentPost extends Post {
|
||||
const post = this.props.post;
|
||||
const attrs = super.attrs();
|
||||
|
||||
attrs.className =
|
||||
(attrs.className || '') +
|
||||
' ' +
|
||||
classNames({
|
||||
CommentPost: true,
|
||||
'Post--hidden': post.isHidden(),
|
||||
'Post--edited': post.isEdited(),
|
||||
revealContent: this.revealContent,
|
||||
editing: this.isEditing(),
|
||||
});
|
||||
attrs.className = classNames(
|
||||
attrs.className,
|
||||
'CommentPost',
|
||||
post.isHidden() && 'Post--hidden',
|
||||
post.isEdited() && 'Post--edited',
|
||||
this.revealContent && 'revealContent',
|
||||
this.isEditing() && 'editing'
|
||||
);
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
@ -76,15 +76,13 @@ export default class Search extends Component {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
'Search ' +
|
||||
classNames({
|
||||
open: this.value() && this.hasFocus,
|
||||
focused: this.hasFocus,
|
||||
active: !!currentSearch,
|
||||
loading: !!this.loadingSources,
|
||||
})
|
||||
}
|
||||
className={classNames(
|
||||
'Search',
|
||||
this.value() && this.hasFocus && 'open',
|
||||
this.hasFocus && 'focused',
|
||||
!!currentSearch && 'active',
|
||||
!!this.loadingSources && 'loading'
|
||||
)}
|
||||
>
|
||||
<div className="Search-input">
|
||||
<input
|
||||
@ -143,7 +141,7 @@ export default class Search extends Component {
|
||||
|
||||
// Handle input key events on the search input, triggering results to load.
|
||||
$input
|
||||
.on('input focus', function() {
|
||||
.on('input focus', function(this: HTMLInputElement) {
|
||||
const query = this.value.toLowerCase();
|
||||
|
||||
if (!query) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user