How to use @contentful/rich-text-react-renderer - 5 common examples

To help you get started, we’ve selected a few @contentful/rich-text-react-renderer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Codeminer42 / gatsby-theme-careers / src / templates / job.js View on Github external
{job.title}
        

        
      

      
        
          

          {job.body && documentToReactComponents(job.body.json)}

          <button width="240px">
            Apply
          </button>
        

        {/* 
          <button width="{1}">Apply</button>
         */}
      
    
  )
}
github keenethics / keenethics / pages / post.js View on Github external
if (_.get(node, 'data.target.sys.contentType.sys.id') === 'suggestion') {
        const {
          body,
          suggesterName,
          suggesterPosition,
          suggestionTitle,
          suggesterPhoto,
          linkedIn,
          buttonText,
          redirectLink,
        } = node.data.target.fields;

        return (
          <div>
            <h5>{suggestionTitle}</h5>
            {documentToReactComponents(body)}
            <div>
              {personComponent({
                image: suggesterPhoto,
                name: suggesterName,
                position: suggesterPosition,
                linkedIn,
              })}
              <a rel="noopener noreferrer" href="{redirectLink">
                <button type="button">
                  {buttonText || 'Schedule a call'}
                </button>
              </a></div></div>
github keenethics / keenethics / pages / post.js View on Github external
const embeddedEntryComponent = ({ type, list }) =&gt; (
  <div>
    <div>
      <img src="{`/static/images/${EMBEDDED_ENTRY_ICON_NAMES[type]}.png`}" alt="Bulb icon">
    </div>
    <div>
      <h4>{EMBEDDED_ENTRY_HEADERS[type]}</h4>
      {!!list &amp;&amp; documentToReactComponents(list)}
    </div>
  </div>
);
github keenethics / keenethics / pages / post.js View on Github external
[BLOCKS.EMBEDDED_ENTRY]: (node) =&gt; {
      if (_.get(node, 'data.target.sys.contentType.sys.id') === 'usefulReadings') {
        const { bookList, list } = _.get(node, 'data.target.fields', null);

        return (
          <div>
            <div>
              <img src="/static/images/book_icon.png" alt="Book icon">
            </div>
            <div>
              <h4>useful readings:</h4>
              {(bookList || list) &amp;&amp; documentToReactComponents(bookList || list)}
            </div>
          </div>
        );
      }
      if (_.get(node, 'data.target.sys.contentType.sys.id') === 'mostSuitableFor') {
        const { list } = _.get(node, 'data.target.fields', null);

        return embeddedEntryComponent({ list, type: 'mostSuitableFor' });
      }
      if (_.get(node, 'data.target.sys.contentType.sys.id') === 'helpfulTools') {
        const { list } = _.get(node, 'data.target.fields', null);

        return embeddedEntryComponent({ list, type: 'helpfulTools' });
      }
      if (_.get(node, 'data.target.sys.contentType.sys.id') === 'suggestion') {
        const {
github keenethics / keenethics / pages / post.js View on Github external
{url &amp;&amp; socialMediaShareButtons({ url: this.props.url.asPath })}
            
          

          <article>
            {author &amp;&amp; personComponent(author.fields)}
            <header>
              <h1>{title}</h1>

              {subtitle &amp;&amp; <h2>{subtitle}</h2>}
              {description &amp;&amp; <p>{description}</p>}
              {heroSrc &amp;&amp; imageComponent({ src: heroSrc, title: heroTitle })}
            </header>

            <main>{documentToReactComponents(bodyRich, bodyOptions)}</main>

            <footer>
              {url &amp;&amp; socialMediaShareButtons({ url: this.props.url.asPath })}
              
            </footer>
          </article>

          <footer>
            <div>
              <div>
                <hr>
                <div>
                  {!!relatedPosts.length &amp;&amp; <h3>Check out our articles:</h3>}
                  <a href="/blog">Back to blog</a>
                </div>
                {!!relatedPosts.length &amp;&amp; (</div></div></footer>

@contentful/rich-text-react-renderer

React renderer for the Contentful rich text field type.

MIT
Latest version published 11 days ago

Package Health Score

92 / 100
Full package analysis

Popular @contentful/rich-text-react-renderer functions