How to use the prismic-reactjs.Link.url 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 / 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 / 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 / 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>

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