From 665598c6d4d16a0cb3ac8a9eecc3a24cc40ca225 Mon Sep 17 00:00:00 2001 From: Benaiah Mischenko Date: Wed, 6 Dec 2017 16:54:28 -0800 Subject: Move Values page into the CMS --- src/js/cms-preview-templates/values.js | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/js/cms-preview-templates/values.js (limited to 'src/js/cms-preview-templates/values.js') diff --git a/src/js/cms-preview-templates/values.js b/src/js/cms-preview-templates/values.js new file mode 100644 index 0000000..173d0c9 --- /dev/null +++ b/src/js/cms-preview-templates/values.js @@ -0,0 +1,46 @@ +import React from "react"; +import { List } from 'immutable'; + +import Jumbotron from "./components/jumbotron"; + +const MediaBlock = ({heading, text, imageUrl, reverse}) => { + const imageContainerClassName = reverse + ? "ph3-m w-50-m" + : "ph3-m w-50-m order-last-m"; + return
+
+ +
+
+

{heading}

+

{text}

+
+
; +}; + +export default class ValuesPreview extends React.Component { + render() { + const {entry, getAsset} = this.props; + + let image = getAsset(entry.getIn(["data", "image"])); + + // Bit of a nasty hack to make relative paths work as expected as a background image here + if (image && !image.fileObj) { + image = window.parent.location.protocol + "//" + window.parent.location.host + image; + } + + const entryValues = entry.getIn(["data", "values"]); + const values = entryValues ? entryValues.toJS() : []; + + return
+ +
+
+ {values.map(({text, heading, imageUrl}, i) => + + )} +
+
+
; + } +} -- cgit v1.3