import React from 'react'; import i18n from 'i18n'; import SilverStripeComponent from 'lib/SilverStripeComponent'; /** * Renders the right-hand collapsable change preview panel */ class Preview extends SilverStripeComponent { render() { // @todo - Multiple preview views with toggle slider let body = null; let previewUrl = null; let previewType = ''; // Find preview url if (this.props.itemLinks && this.props.itemLinks.preview) { if (this.props.itemLinks.preview.Stage) { previewUrl = this.props.itemLinks.preview.Stage.href; previewType = this.props.itemLinks.preview.Stage.type; } else if (this.props.itemLinks.preview.Live) { previewUrl = this.props.itemLinks.preview.Live.href; previewType = this.props.itemLinks.preview.Live.type; } } // Build actions let editUrl = null; const editKey = 'edit'; let toolbarButtons = []; if (this.props.itemLinks && this.props.itemLinks.edit) { editUrl = this.props.itemLinks.edit.href; toolbarButtons.push( { i18n._t('Preview.EDIT', 'Edit') } ); } // Build body if (!this.props.itemId) { body = (