Skip to content

Commit

Permalink
update routing UI design
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishtaplin committed Aug 2, 2019
1 parent 5bfc05c commit a39ebab
Show file tree
Hide file tree
Showing 55 changed files with 1,033 additions and 872 deletions.
2 changes: 2 additions & 0 deletions eq-author-api/schema/resolvers/routing2/routingRule2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Resolvers.Mutation = {
),
deleteRoutingRule2: createMutation((root, { input }, ctx) => {
const pages = getPages(ctx);

const page = find(page => {
const routing = page.routing || { rules: [] };
if (some({ id: input.id }, routing.rules)) {
Expand All @@ -154,6 +155,7 @@ Resolvers.Mutation = {
}, pages);

const routing = page.routing;

routing.rules = reject({ id: input.id }, routing.rules);
if (routing.rules.length === 0) {
page.routing = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SORT_ORDER } from "../constants";

import Row from "./Row";
import TableHead from "./TableHead";
import Panel from "components/Panel";

const Table = styled.table`
width: 100%;
Expand All @@ -18,12 +19,6 @@ const Table = styled.table`
text-align: left;
`;

const Panel = styled.div`
background: white;
border-radius: 4px;
border: 1px solid #ccc;
`;

const QuestionnairesTable = ({
questionnaires,
onDeleteQuestionnaire,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CollapsiblesEditor should render 1`] = `
<CollapsiblesEditor__DetailList>
<div>
<Reorder
Transition={[Function]}
data-test="collapsibles-list"
Expand All @@ -25,5 +25,5 @@ exports[`CollapsiblesEditor should render 1`] = `
>
Add collapsible
</CollapsiblesEditor__AddButton>
</CollapsiblesEditor__DetailList>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import withCreateCollapsible from "./withCreateCollapsible";
import CollapsibleEditor from "./CollapsibleEditor";
import withMoveCollapsible from "./withMoveCollapsible";

const DetailList = styled.div`
margin-bottom: 2em;
`;

const AddButton = styled(Button)`
width: 100%;
`;
Expand All @@ -26,7 +22,7 @@ export const CollapsiblesEditor = ({
moveCollapsible,
introductionId,
}) => (
<DetailList>
<div>
<Reorder
list={collapsibles}
onMove={moveCollapsible}
Expand All @@ -44,7 +40,7 @@ export const CollapsiblesEditor = ({
>
Add collapsible
</AddButton>
</DetailList>
</div>
);

CollapsiblesEditor.fragments = [...CollapsibleEditor.fragments];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import iconCheck from "./icon-check.svg";

const LegalField = styled.div`
display: flex;
margin-bottom: 2em;
`;

const LegalInput = styled(Input)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import withUpdateQuestionnaireIntroduction from "./withUpdateQuestionnaireIntrod
const Section = styled.section`
&:not(:last-of-type) {
border-bottom: 1px solid #e0e0e0;
margin-bottom: 2em;
}
`;

const Padding = styled.div`
padding: 0 2em;
padding: 2em;
`;

const SectionTitle = styled.h2`
Expand Down
9 changes: 2 additions & 7 deletions eq-author/src/App/introduction/IntroductionLayout.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import React from "react";
import PropTypes from "prop-types";
import styled from "styled-components";

import EditorLayout from "components/EditorLayout";

const Padding = styled.div`
padding: 2em 0 0;
position: relative;
width: 100%;
`;
import Panel from "components/Panel";

const IntroductionLayout = ({ children }) => (
<EditorLayout preview title="Questionnaire Introduction">
<Padding>{children}</Padding>
<Panel>{children}</Panel>
</EditorLayout>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ exports[`IntroductionLayout should render 1`] = `
preview={true}
title="Questionnaire Introduction"
>
<IntroductionLayout__Padding>
<Panel>
<div />
</IntroductionLayout__Padding>
</Panel>
</EditorLayout>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ exports[`Option should render a checkbox 1`] = `
}
.c0 {
border: 1px solid #c3c3c3;
border: 1px solid #d6d8da;
padding: 1em 1em 0;
border-radius: 4px;
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`components/Answers/Dummy/TextArea shoulder render 1`] = `
-webkit-transition: outline-color 100ms ease-in,border-color 100ms ease-in;
transition: outline-color 100ms ease-in,border-color 100ms ease-in;
outline: 1px solid transparent;
border-color: #c3c3c3;
border-color: #d6d8da;
padding: 1.2em 1.2em 1.2em 2em;
position: relative;
background-color: transparent;
Expand Down
4 changes: 3 additions & 1 deletion eq-author/src/App/page/Design/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Loading from "components/Loading";
import Error from "components/Error";
import EditorLayout from "components/EditorLayout";

import Panel from "components/Panel";

import withCreateQuestionPage from "enhancers/withCreateQuestionPage";

import PropertiesPanel from "../PropertiesPanel";
Expand Down Expand Up @@ -92,7 +94,7 @@ export class UnwrappedPageRoute extends React.Component {
title={(page || {}).displayName || ""}
{...deriveAvailableTabs(page)}
>
{this.renderContent()}
<Panel>{this.renderContent()}</Panel>
</EditorLayout>
);
}
Expand Down
106 changes: 54 additions & 52 deletions eq-author/src/App/page/Preview/CalculatedSummaryPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PageTitle from "components/preview/elements/PageTitle";
import Info from "components/preview/elements/Info";

import EditorLayout from "components/EditorLayout";

import Panel from "components/Panel";
import { Grid, Column } from "components/Grid";

import { colors } from "constants/theme";
Expand Down Expand Up @@ -82,57 +82,59 @@ const SummaryTotalLabel = styled.div`
const CalculatedSummaryPagePreview = ({ page }) => {
return (
<EditorLayout page={page} preview routing={false}>
<Container>
<PageTitle title={page.title} />
<Info>Please review your answers and confirm these are correct.</Info>

{page.summaryAnswers.length > 0 ? (
<Summary>
{page.summaryAnswers.map(answer => (
<SummaryItem key={answer.id}>
<Grid>
<Column cols={7}>
<SummaryLabel data-test="answer-item">
{answer.displayName}
</SummaryLabel>
</Column>
<Column cols={3}>
<SummaryValue>Value</SummaryValue>
</Column>
<Column cols={2}>
<SummaryLink>Change</SummaryLink>
</Column>
</Grid>
</SummaryItem>
))}

{page.totalTitle ? (
<SummaryTotal>
<Grid>
<Column cols={7}>
<SummaryTotalLabel
data-test="total-title"
dangerouslySetInnerHTML={{ __html: page.totalTitle }}
/>
</Column>
<Column cols={3}>
<SummaryValue>Value</SummaryValue>
</Column>
<Column cols={2} />
</Grid>
</SummaryTotal>
) : (
<Error large data-test="no-total-title">
Missing total title
</Error>
)}
</Summary>
) : (
<Error large data-test="no-answers-selected">
No answers selected
</Error>
)}
</Container>
<Panel>
<Container>
<PageTitle title={page.title} />
<Info>Please review your answers and confirm these are correct.</Info>

{page.summaryAnswers.length > 0 ? (
<Summary>
{page.summaryAnswers.map(answer => (
<SummaryItem key={answer.id}>
<Grid>
<Column cols={7}>
<SummaryLabel data-test="answer-item">
{answer.displayName}
</SummaryLabel>
</Column>
<Column cols={3}>
<SummaryValue>Value</SummaryValue>
</Column>
<Column cols={2}>
<SummaryLink>Change</SummaryLink>
</Column>
</Grid>
</SummaryItem>
))}

{page.totalTitle ? (
<SummaryTotal>
<Grid>
<Column cols={7}>
<SummaryTotalLabel
data-test="total-title"
dangerouslySetInnerHTML={{ __html: page.totalTitle }}
/>
</Column>
<Column cols={3}>
<SummaryValue>Value</SummaryValue>
</Column>
<Column cols={2} />
</Grid>
</SummaryTotal>
) : (
<Error large data-test="no-total-title">
Missing total title
</Error>
)}
</Summary>
) : (
<Error large data-test="no-answers-selected">
No answers selected
</Error>
)}
</Container>
</Panel>
</EditorLayout>
);
};
Expand Down
Loading

0 comments on commit a39ebab

Please sign in to comment.