Skip to content

Commit

Permalink
Merge branch 'master' into EAR-2305-data-version-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
farres1 authored Mar 4, 2024
2 parents c2efa1a + 9be1d5e commit 7617aa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { propType } from "graphql-anywhere";
import { get, flowRight, some } from "lodash";
import styled from "styled-components";
import gql from "graphql-tag";
import DescribedText from "components/DescribedText";

import { richTextEditorErrors } from "constants/validationMessages";
import { colors } from "constants/theme";
Expand Down Expand Up @@ -203,11 +202,7 @@ export const CalculatedSummaryPageEditor = (props) => {
<RichTextEditor
id="summary-title"
name="title"
label={
<DescribedText description='The question "Is this correct?" will be added to the end of the calculated summary title.'>
Calculated summary title
</DescribedText>
}
label="Calculated summary title"
placeholder=""
value={page.title}
onUpdate={onChangeUpdate}
Expand All @@ -222,7 +217,6 @@ export const CalculatedSummaryPageEditor = (props) => {
autoFocus={!page.title}
pageType={page.pageType}
/>

<HorizontalRule />
<PageTitleContainer
pageDescription={page.pageDescription}
Expand Down
42 changes: 8 additions & 34 deletions eq-author/src/App/page/Preview/CalculatedSummaryPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { propType } from "graphql-anywhere";
import styled from "styled-components";
import Error from "components/preview/Error";
import PageTitle from "components/preview/elements/PageTitle";
import Info from "components/preview/elements/Info";

import EditorLayout from "components/EditorLayout";
import Panel from "components/Panel";
Expand All @@ -15,20 +16,6 @@ import { colors } from "constants/theme";
import CalculatedSummaryPageEditor from "../Design/CalculatedSummaryPageEditor";
import { useSetNavigationCallbacksForPage } from "components/NavigationCallbacks";

const Button = styled.div`
color: white;
background-color: ${colors.positive};
border: 2px solid ${colors.positive};
padding: 0.75rem 1rem;
margin: 0;
font-size: 1rem;
font-weight: 600;
border-radius: 3px;
display: inline-block;
text-rendering: optimizeLegibility;
margin-bottom: 2em;
`;

const Container = styled.div`
padding: 2em;
font-size: 1.1em;
Expand Down Expand Up @@ -57,9 +44,7 @@ const Summary = styled.div`
`;

const SummaryItem = styled.div`
&:not(:first-of-type) {
border-top: 1px solid #999;
}
border-top: 1px solid #999;
border-radius: 0;
position: relative;
padding: 1rem 0;
Expand Down Expand Up @@ -104,17 +89,6 @@ const CalculatedSummaryPagePreview = ({ page }) => {
section: page?.section,
});

const addConfirmationToTitle = () => {
if (page.title) {
const titleWithoutClosingParagraphTag = page.title.replace(/<\/p>$/, "");
if (titleWithoutClosingParagraphTag.endsWith(".")) {
return `${page.title} Is this correct?`;
} else {
return `${page.title}. Is this correct?`;
}
}
};

return (
<EditorLayout
title={page.displayName}
Expand All @@ -128,7 +102,9 @@ const CalculatedSummaryPagePreview = ({ page }) => {
>
<Panel data-test="calSum test page">
<Container>
<PageTitle title={addConfirmationToTitle()} />
<PageTitle title={page.title} />
<Info>Please review your answers and confirm these are correct.</Info>

{page.summaryAnswers.length > 0 ? (
<Summary>
{page.summaryAnswers.map((answer) => (
Expand All @@ -153,10 +129,9 @@ const CalculatedSummaryPagePreview = ({ page }) => {
<SummaryTotal>
<Grid>
<Column cols={7}>
<SummaryTotalLabel
data-test="total-title"
dangerouslySetInnerHTML={{ __html: page.totalTitle }}
/>
<SummaryTotalLabel data-test="total-title">
{page.totalTitle.replace(/<\/?p>/g, "")}
</SummaryTotalLabel>
</Column>
<Column cols={3}>
<SummaryValue>Value</SummaryValue>
Expand All @@ -175,7 +150,6 @@ const CalculatedSummaryPagePreview = ({ page }) => {
No answers selected
</Error>
)}
<Button>Yes, I confirm this is correct</Button>
</Container>
</Panel>
</EditorLayout>
Expand Down

0 comments on commit 7617aa3

Please sign in to comment.