Signal-Desktop/ts/util/getClassNamesFor.ts

18 lines
441 B
TypeScript
Raw Normal View History

2021-05-11 00:50:43 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import classNames from 'classnames';
export function getClassNamesFor(
...modules: Array<string | undefined>
): (modifier?: string) => string {
return modifier => {
const cx = modules.map(parentModule =>
parentModule && modifier !== undefined
? `${parentModule}${modifier}`
: undefined
);
return classNames(cx);
};
}