How to use the prismic-reactjs.RichText.asText function in prismic-reactjs

To help you get started, weโ€™ve selected a few prismic-reactjs 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 prismicio / universal-react-website / src / shared / app / Layout.js View on Github external
const menu = props.menu.data.menu_links.map(function(menuItem, index){
    var menuLink = PrismicLink.url(menuItem.link, PrismicConfig.linkResolver);
    var label = RichText.asText(menuItem.label);
    return <li>{label}</li>;
  });
github prismicio / universal-react-website / src / shared / app / slices / ImageHighlight.js View on Github external
export const ImageHighlight = (props) =&gt; {
  
  var highlight = props.slice;
  var link = PrismicLink.url(highlight.primary.link, PrismicConfig.linkResolver);
  var label = RichText.asText(highlight.primary.link_label);
  var button = null;
  if (link &amp;&amp; label != " ") {
    button = <p>{label}</p>;
  }
  
  return (
    <section>
      <div>
        { RichText.render(highlight.primary.title, PrismicConfig.linkResolver) }
        { RichText.render(highlight.primary.headline, PrismicConfig.linkResolver) }
        { button }
      </div>
      <div>
        <img src="{">
      </div>
    </section>
github prismicio / universal-react-website / src / shared / app / slices / ImageGallery.js View on Github external
var gallery = props.slice.items.map(function(galleryItem, index){
    
    var description = RichText.render(galleryItem.image_description, PrismicConfig.linkResolver);
    var link = PrismicLink.url(galleryItem.link, PrismicConfig.linkResolver);
    var label = RichText.asText(galleryItem.link_label);
    var button = null;
    if (link &amp;&amp; label != " ") {
      button = <p>{label}</p>;
    }
    
    return (
      <div>
        <img src="{galleryItem.image.url}/">
        { description }
        { button }
      </div>
    );
  });
github prismicio / universal-react-website / src / shared / app / slices / HomeBanner.js View on Github external
export const HomeBanner = (props) =&gt; {
  
  var banner = props.document.data.homepage_banner[0];
  var bannerStyle = { backgroundImage: 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url(' + banner.image.url + ')' };
  
  var link = PrismicLink.url(banner.button_link, PrismicConfig.linkResolver);
  var label = RichText.asText(banner.button_label);
  var button = null;
  if (link &amp;&amp; label != " ") {
    button = {label};
  }
  
  return (
    <section style="{bannerStyle}">
      <div>
        <h2>{ RichText.asText(banner.title) }</h2>
        <p>{ RichText.asText(banner.tagline) }</p>
        { button }
      </div>
    </section>
  );
};
github birkir / gatsby-source-prismic-graphql / examples / arnaud / src / components / blogpost.js View on Github external
const BlogPost = props =&gt; {
  const edges = get(props.data, 'prismic.allBlogposs.edges', []);
  const data = get(edges, '0.node');

  if (!data) {
    return null;
  }

  return (
    <div id="blogpost">
      <h1>{RichText.asText(data.title)}</h1>
      {RichText.render(data.body, linkResolver)}
    </div>
  );
};
github prismicio / universal-react-website / src / shared / app / slices / HomeBanner.js View on Github external
export const HomeBanner = (props) =&gt; {
  
  var banner = props.document.data.homepage_banner[0];
  var bannerStyle = { backgroundImage: 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url(' + banner.image.url + ')' };
  
  var link = PrismicLink.url(banner.button_link, PrismicConfig.linkResolver);
  var label = RichText.asText(banner.button_label);
  var button = null;
  if (link &amp;&amp; label != " ") {
    button = {label};
  }
  
  return (
    <section style="{bannerStyle}">
      <div>
        <h2>{ RichText.asText(banner.title) }</h2>
        <p>{ RichText.asText(banner.tagline) }</p>
        { button }
      </div>
    </section>
  );
};
github prismicio / universal-react-website / src / shared / app / slices / Quote.js View on Github external
export const Quote = (props) =&gt; {
  
  var sectionClass = "content-section ";
  if (props.slice.slice_label) {
    sectionClass += "text-section-" + props.slice.slice_label;
  } else {
    sectionClass += "text-section-1col";
  }
  
  return (
    <section>
      <blockquote>
        {RichText.asText(props.slice.primary.quote_text)}
      </blockquote>
    </section>
  );
};
github prismicio / universal-react-website / src / shared / app / slices / HomeBanner.js View on Github external
var banner = props.document.data.homepage_banner[0];
  var bannerStyle = { backgroundImage: 'linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url(' + banner.image.url + ')' };
  
  var link = PrismicLink.url(banner.button_link, PrismicConfig.linkResolver);
  var label = RichText.asText(banner.button_label);
  var button = null;
  if (link &amp;&amp; label != " ") {
    button = {label};
  }
  
  return (
    <section style="{bannerStyle}">
      <div>
        <h2>{ RichText.asText(banner.title) }</h2>
        <p>{ RichText.asText(banner.tagline) }</p>
        { button }
      </div>
    </section>
  );
};

prismic-reactjs

render prismic rich text as React Element

Apache-2.0
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages