|
| 1 | +import React from "react"; |
| 2 | +import CMS from "netlify-cms"; |
| 3 | + |
| 4 | +import Features from 'site/components/Features'; |
| 5 | +import Testimonials from 'site/components/Testimonials'; |
| 6 | +import Pricing from 'site/components/Pricing'; |
| 7 | + |
| 8 | +const AboutPagePreview = ({ entry, widgetFor }) => |
| 9 | + <section className="section section--gradient"> |
| 10 | + <div className="container"> |
| 11 | + <div className="columns"> |
| 12 | + <div className="column is-10 is-offset-1"> |
| 13 | + <div className="section"> |
| 14 | + <h2 className="title is-size-3 has-text-weight-bold is-bold-light"> |
| 15 | + {entry.getIn(["data", "title"])} |
| 16 | + </h2> |
| 17 | + <div className="content">{widgetFor('body')}</div> |
| 18 | + </div> |
| 19 | + </div> |
| 20 | + </div> |
| 21 | + </div> |
| 22 | + </section> |
| 23 | + |
| 24 | +const BlogPostPreview = ({ entry, widgetFor }) => |
| 25 | + <section className="section"> |
| 26 | + <div className="container content"> |
| 27 | + <div className="columns"> |
| 28 | + <div className="column is-10 is-offset-1"> |
| 29 | + <h1 className="title is-size-2 has-text-weight-bold is-bold-light"> |
| 30 | + {entry.getIn(["data", "title"])} |
| 31 | + </h1> |
| 32 | + <p>{entry.getIn(["data", "description"])}</p> |
| 33 | + <div>{widgetFor("body")}</div> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + </div> |
| 37 | + </section> |
| 38 | + |
| 39 | +const ProductPagePreview = ({ entry, widgetFor, getAsset }) => { |
| 40 | + |
| 41 | + const entryBlurbs = entry.getIn(["data", "intro", "blurbs"]); |
| 42 | + const blurbs = entryBlurbs ? entryBlurbs.toJS() : []; |
| 43 | + |
| 44 | + const entryTestimonials = entry.getIn(["data", "testimonials"]); |
| 45 | + const testimonials = entryTestimonials ? entryTestimonials.toJS() : []; |
| 46 | + |
| 47 | + const entryPricingPlans = entry.getIn(["data", "pricing", "plans"]); |
| 48 | + const pricingPlans = entryPricingPlans ? entryPricingPlans.toJS() : []; |
| 49 | + |
| 50 | + return <section className="section section--gradient"> |
| 51 | + <div className="container"> |
| 52 | + <div className="section"> |
| 53 | + <div className="columns"> |
| 54 | + <div className="column is-10 is-offset-1"> |
| 55 | + <div className="content"> |
| 56 | + <div |
| 57 | + className="full-width-image-container margin-top-0" |
| 58 | + style={{ backgroundImage: `url(${getAsset(entry.getIn(["data", "image"]))})` }} |
| 59 | + > |
| 60 | + <h2 |
| 61 | + className="has-text-weight-bold is-size-1" |
| 62 | + style={{ |
| 63 | + boxShadow: '0.5rem 0 0 #f40, -0.5rem 0 0 #f40', |
| 64 | + backgroundColor: '#f40', |
| 65 | + color: 'white', |
| 66 | + padding: '1rem' |
| 67 | + }} |
| 68 | + > |
| 69 | + {entry.getIn(["data", "title"])} |
| 70 | + </h2> |
| 71 | + </div> |
| 72 | + <div className="columns"> |
| 73 | + <div className="column is-7"> |
| 74 | + <h3 className="has-text-weight-semibold is-size-2">{entry.getIn(["data", "heading"])}</h3> |
| 75 | + <p>{entry.getIn(["data", "description"])}</p> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + <Features gridItems={blurbs} /> |
| 79 | + <div className="columns"> |
| 80 | + <div className="column is-7"> |
| 81 | + <h3 className="has-text-weight-semibold is-size-3">{entry.getIn(["data", "main", "heading"])}</h3> |
| 82 | + <p>{entry.getIn(["main", "description"])}</p> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | + <div className="tile is-ancestor"> |
| 86 | + <div className="tile is-vertical"> |
| 87 | + <div className="tile"> |
| 88 | + <div className="tile is-parent is-vertical"> |
| 89 | + <article className="tile is-child"> |
| 90 | + <img |
| 91 | + style={{ borderRadius: '5px' }} |
| 92 | + src={entry.getIn(["data", "main", "image1", "image"])} |
| 93 | + alt="" |
| 94 | + /> |
| 95 | + </article> |
| 96 | + </div> |
| 97 | + <div className="tile is-parent"> |
| 98 | + <article className="tile is-child"> |
| 99 | + <img |
| 100 | + style={{ borderRadius: '5px' }} |
| 101 | + src={entry.getIn(["data", "main", "image2", "image"])} |
| 102 | + alt="" |
| 103 | + /> |
| 104 | + </article> |
| 105 | + </div> |
| 106 | + </div> |
| 107 | + <div className="tile is-parent"> |
| 108 | + <article className="tile is-child"> |
| 109 | + <img |
| 110 | + style={{ borderRadius: '5px' }} |
| 111 | + src={entry.getIn(["data", "main", "image3", "image"])} |
| 112 | + alt="" |
| 113 | + /> |
| 114 | + </article> |
| 115 | + </div> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + <Testimonials testimonials={testimonials} /> |
| 119 | + <div |
| 120 | + className="full-width-image-container" |
| 121 | + style={{ backgroundImage: `url(${getAsset(entry.getIn(["data", "full_image"]))})` }} |
| 122 | + /> |
| 123 | + <h2 className="has-text-weight-semibold is-size-2">{entry.getIn(["data", "pricing", "heading"])}</h2> |
| 124 | + <p className="is-size-5">{entry.getIn(["data", "pricing", "description"])}</p> |
| 125 | + <Pricing data={pricingPlans} /> |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + </div> |
| 130 | + </div> |
| 131 | + </section> |
| 132 | +} |
| 133 | + |
| 134 | + |
| 135 | +CMS.registerPreviewStyle("/styles.css"); |
| 136 | +CMS.registerPreviewTemplate("about", AboutPagePreview); |
| 137 | +CMS.registerPreviewTemplate("products", ProductPagePreview); |
| 138 | +CMS.registerPreviewTemplate("blog", BlogPostPreview); |
0 commit comments