diff --git a/ui-admin/src/portal/siteContent/SiteContentEditor.test.tsx b/ui-admin/src/portal/siteContent/SiteContentEditor.test.tsx index 0762d27c12..a0feb02977 100644 --- a/ui-admin/src/portal/siteContent/SiteContentEditor.test.tsx +++ b/ui-admin/src/portal/siteContent/SiteContentEditor.test.tsx @@ -52,3 +52,17 @@ test('readOnly hides save button', async () => { expect(screen.getByText('Landing page')).toBeInTheDocument() expect(screen.queryByText('Save')).not.toBeInTheDocument() }) + +test('clicking on the Preview tab shows full page preview', async () => { + const siteContent = mockSiteContent() + const { RoutedComponent } = setupRouterTest( + ) + render(RoutedComponent) + + await userEvent.click(screen.getByText('Preview')) + expect(screen.queryByText('Insert section')).not.toBeInTheDocument() + expect(screen.queryByText('we are the best')).toBeInTheDocument() +}) diff --git a/ui-admin/src/portal/siteContent/SiteContentEditor.tsx b/ui-admin/src/portal/siteContent/SiteContentEditor.tsx index c20d7de76c..ba96b05146 100644 --- a/ui-admin/src/portal/siteContent/SiteContentEditor.tsx +++ b/ui-admin/src/portal/siteContent/SiteContentEditor.tsx @@ -1,14 +1,16 @@ import React, { useState } from 'react' -import { NavbarItemInternal, PortalEnvironment } from 'api/api' +import { HtmlSection, NavbarItemInternal, PortalEnvironment } from 'api/api' import Select from 'react-select' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faClockRotateLeft, faImage, faPlus } from '@fortawesome/free-solid-svg-icons' import HtmlPageEditView from './HtmlPageEditView' -import { HtmlPage, LocalSiteContent, ApiProvider, SiteContent, ApiContextT } from '@juniper/ui-core' +import { HtmlPage, LocalSiteContent, ApiProvider, SiteContent, ApiContextT, HtmlSectionView } from '@juniper/ui-core' import { Link } from 'react-router-dom' import SiteContentVersionSelector from './SiteContentVersionSelector' -import { Button } from '../../components/forms/Button' +import { Button } from 'components/forms/Button' import AddPageModal from './AddPageModal' +import ErrorBoundary from 'util/ErrorBoundary' +import { Tab, Tabs } from 'react-bootstrap' type NavbarOption = {label: string, value: string} const landingPageOption = { label: 'Landing page', value: 'Landing page' } @@ -31,6 +33,7 @@ const SiteContentEditor = (props: InitializedSiteContentViewProps) => { portalEnv, loadSiteContent, switchToVersion, createNewVersion, readOnly } = props const selectedLanguage = 'en' + const [activeTab, setActiveTab] = useState('designer') const [selectedNavOpt, setSelectedNavOpt] = useState(landingPageOption) const [workingContent, setWorkingContent] = useState(siteContent) const [showVersionSelector, setShowVersionSelector] = useState(false) @@ -160,12 +163,41 @@ const SiteContentEditor = (props: InitializedSiteContentViewProps) => { -
- {pageToRender && - - updatePage(page, currentNavBarItem?.text)}/> - } +
+ + + +
+ {pageToRender && + + updatePage(page, currentNavBarItem?.text)}/> + } +
+
+
+ + + + { pageToRender.sections.map((section: HtmlSection) => + ) + } + + + +
{ showVersionSelector &&