Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x | import React from "react"; import { trans_obj, Translatable } from "./i18n"; /** * Formats a user label appropriately */ export function formatUserLabel(inputConfig: Translatable | string) { const label = typeof inputConfig === "string" ? inputConfig : trans_obj(inputConfig); if (!label) { return <span />; } const iconData = label.match(/^\[\[\s*(.*?)\s*(;\s*(.*?))?\s*\]\]$/); if (iconData) { let className = "fa fa-" + iconData[1]; if ((iconData[3] || "").match(/90|180|270/)) { className += " fa-rotate-" + iconData[3]; } return <i className={className} />; } return <span>{label}</span>; } |