@limetech/lime-elements
Version:
40 lines (39 loc) • 773 B
JavaScript
import translate from '../../global/translations';
const calloutIcons = {
note: 'info',
important: 'exclamation_mark',
tip: 'idea',
caution: 'high_priority',
warning: 'error',
};
/**
*
* @param icon
* @param type
*/
export function getIcon(icon, type = 'note') {
var _a;
if (icon) {
return icon;
}
return (_a = calloutIcons[type]) !== null && _a !== void 0 ? _a : calloutIcons.note;
}
/**
*
* @param heading
* @param type
* @param language
*/
export function getHeading(heading, type = 'note', language = 'en') {
if (heading) {
return heading;
}
const key = `callout.${type}`;
try {
return translate.get(key, language);
}
catch (_a) {
return translate.get(key, 'en');
}
}
//# sourceMappingURL=callout.helpers.js.map