name:
src/main/js/common/utils/CSS.ts
-rw-r--r--
526
1import { isUndefined } from "./Types";
2
3/**
4 * Join class names together.
5 * @param values - to join together.
6 */
7export function classNames(...values: Array<string>): string {
8 return values
9 .filter(function (value: string) {
10 return value != "" && !isUndefined(value);
11 })
12 .join(" ");
13}
14
15/**
16 * Return the class if the value to check is true
17 * @param className
18 * @param value
19 */
20export function includeClassIf(className: string, value: boolean) {
21 if (value) {
22 return className;
23 }
24 return "";
25}