We added contentful-common-strings in #32 but looking at the two external PRs that use it, JustFixNYC/who-owns-what#482 and JustFixNYC/tenants2#2125, it's apparent that we have some repeated code of the following form, which is used to ensure that hyperlinks always open in new tabs:
mport { RenderNode } from "@contentful/rich-text-react-renderer";
const RENDER_NODE: RenderNode = {
[INLINES.HYPERLINK]: (node, children) => (
<a rel="noreferrer noopener" target="_blank" href={node.data.uri}>
{children}
</a>
),
};
We might want to put this in a package, but it's unclear which package that should be: do we want to use contentful-common-strings, which currently has no dependency on React or @contentful/rich-text-react-renderer, or do we want to use react-common, which already depends on React and can also be used outside the context of the Contentful common strings concept (which might be useful since this renderer isn't necessarily specific to common strings)? Or do we want to make a brand-new package?
We added
contentful-common-stringsin #32 but looking at the two external PRs that use it, JustFixNYC/who-owns-what#482 and JustFixNYC/tenants2#2125, it's apparent that we have some repeated code of the following form, which is used to ensure that hyperlinks always open in new tabs:We might want to put this in a package, but it's unclear which package that should be: do we want to use
contentful-common-strings, which currently has no dependency on React or@contentful/rich-text-react-renderer, or do we want to usereact-common, which already depends on React and can also be used outside the context of the Contentful common strings concept (which might be useful since this renderer isn't necessarily specific to common strings)? Or do we want to make a brand-new package?