How to use prismic-reactjs - 10 common examples

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 / slices / ImageHighlight.js View on Github external
export const ImageHighlight = (props) => {
  
  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 && 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
export const ImageGallery = (props) =&gt; {
  
  var galleryTitle = RichText.render(props.slice.primary.gallery_title);
  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 / 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 margueriteroth / gatsby-prismic-starter-prist / src / templates / post.jsx View on Github external
{post.post_author}
                    
                    
                        {post.post_date}
                    
                
                    {post.post_hero_image &amp;&amp; (
                    
                        <img alt="bees" src="{post.post_hero_image.url}">
                        
                            {RichText.render(post.post_hero_annotation)}
                        
                    
                )}
                
                    {RichText.render(post.post_body)}
                
            
        
    )
}
github margueriteroth / gatsby-prismic-starter-prist / src / templates / post.jsx View on Github external
name: `twitter:creator`,
                        content: meta.author,
                    },
                    {
                        name: `twitter:title`,
                        content: meta.title,
                    },
                    {
                        name: `twitter:description`,
                        content: meta.description,
                    },
                ].concat(meta)}
            /&gt;
            
                
                    {RichText.render(post.post_category)}
                
                
                    {RichText.render(post.post_title)}
                
                
                    
                        {post.post_author}
                    
                    
                        {post.post_date}
                    
                
                    {post.post_hero_image &amp;&amp; (
                    
                        <img alt="bees" src="{post.post_hero_image.url}">
github birkir / gatsby-source-prismic-graphql / examples / pagination / src / templates / article.js View on Github external
const Article = props =&gt; {
  const title = get(props.data, 'prismic.allArticles.edges.0.node.title', []);
  const slices = get(props.data, 'prismic.allArticles.edges.0.node.body', []);
  const body = (slices || []).map((slice, index) =&gt; (
    
      {RichText.render(get(slice, 'primary.text', []) || [], linkResolver)}
    
  ));

  return (
    
      {!!title &amp;&amp; RichText.render(title, linkResolver)}
      {body}
      Back to index
    
  );
};
github prismicio / universal-react-website / src / shared / app / slices / TextSection.js View on Github external
export const TextSection = (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>
      {RichText.render(props.slice.primary.rich_text)}
    </section>
  );
};
github margueriteroth / gatsby-prismic-starter-prist / src / components / About.jsx View on Github external
const About = ({ bio, socialLinks }) =&gt; (
    
        
            {socialLinks.map((social, i) =&gt; (
                
                    {social.about_link[0].text}
                    <span>→</span>
                
            ))}
        
        
            {RichText.render(bio)}
        
        
            <a rel="noopener noreferrer" href="mailto:marguerite.roth@gmail.com">
                <button>
                    Email me
                </button>
            </a>
        
    
)
github margueriteroth / gatsby-prismic-starter-prist / src / templates / post.jsx View on Github external
{
                        name: `twitter:title`,
                        content: meta.title,
                    },
                    {
                        name: `twitter:description`,
                        content: meta.description,
                    },
                ].concat(meta)}
            /&gt;
            
                
                    {RichText.render(post.post_category)}
                
                
                    {RichText.render(post.post_title)}
                
                
                    
                        {post.post_author}
                    
                    
                        {post.post_date}
                    
                
                    {post.post_hero_image &amp;&amp; (
                    
                        <img alt="bees" src="{post.post_hero_image.url}">
                        
                            {RichText.render(post.post_hero_annotation)}
                        
github birkir / gatsby-source-prismic-graphql / examples / languages / src / templates / home.js View on Github external
export default function Home(props) {
  const title = get(props.data, 'prismic.allHomepages.edges.0.node.column_title', []);
  const lang = get(props.pageContext, 'alternateLanguages.0.lang', '').replace('en-us', '');

  return (
    
      {RichText.render(title)}
      Click here for alternative language
    
  );
}

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