open-nomad/ui/app/helpers/css-class.js
2023-04-10 15:36:59 +00:00

21 lines
471 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { helper } from '@ember/component/helper';
import { dasherize } from '@ember/string';
/**
* CSS Class
*
* Usage: {{css-class updateType}}
*
* Outputs a css friendly class string from any human string.
* Differs from dasherize by handling slashes.
*/
export function cssClass([updateType]) {
return dasherize(updateType.replace(/\//g, '-'));
}
export default helper(cssClass);