@magicbell/magicbell-react
Version:
React components for building a notification inbox for your app
16 lines • 627 B
JavaScript
import { pathOr } from 'ramda';
import React from 'react';
import { useTranslations } from '../../context/TranslationsContext.js';
/**
*
* @example
* <Text id="header.title" defaultMessage="My Notifications" />
*/
export default function Text({ id, defaultMessage, html = false }) {
const translations = useTranslations();
const localizedText = pathOr(defaultMessage, id.split('.'), translations);
if (html)
return React.createElement("span", { dangerouslySetInnerHTML: { __html: localizedText } });
return React.createElement(React.Fragment, null, localizedText);
}
//# sourceMappingURL=Text.js.map