allow single string in class names attribute
This commit is contained in:
parent
6e2a2e5c76
commit
f1d6a2e989
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Attrs } from "../core/node.ts";
|
||||
import { isNotSkip, join, Skipable } from "../core/utils.ts";
|
||||
import { isNotSkip, isStr, join, Skipable } from "../core/utils.ts";
|
||||
|
||||
export function classNames(vals: Skipable<string>[]): Attrs {
|
||||
const val = join(" ", vals.filter(isNotSkip));
|
||||
export function classNames(vals: string | Skipable<string>[]): Attrs {
|
||||
const val = isStr(vals) ? vals : join(" ", vals.filter(isNotSkip));
|
||||
return !val.length ? {} : { class: val };
|
||||
}
|
||||
|
|
Reference in a new issue