mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 22:43:41 +08:00
a9ded36b57
- Get rid of Bootstrap (except we still rely on some JS) - Use BEM class names - Rework variables/theme config - Fix various bugs, including some on mobile The CSS is still not ideal – it needs to be cleaned up some more. But that can be a focus for after beta.
27 lines
564 B
JavaScript
27 lines
564 B
JavaScript
/**
|
|
* The `classList` utility creates a list of class names by joining an object's
|
|
* keys, but only for values which are truthy.
|
|
*
|
|
* @example
|
|
* classList({ foo: true, bar: false, qux: 'qaz' });
|
|
* // "foo qux"
|
|
*
|
|
* @param {Object} classes
|
|
* @return {String}
|
|
*/
|
|
export default function classList(classes) {
|
|
let classNames;
|
|
|
|
if (classes instanceof Array) {
|
|
classNames = classes.filter(name => name);
|
|
} else {
|
|
classNames = [];
|
|
|
|
for (const i in classes) {
|
|
if (classes[i]) classNames.push(i);
|
|
}
|
|
}
|
|
|
|
return classNames.join(' ');
|
|
}
|