Skip to content

Commit d841206

Browse files
Merge pull request #208 from communitiesuk/FLS-1414-header-change-bkp
FLS-1414: change the header into mhclg header instead of govuk
1 parent 19ccb6d commit d841206

File tree

26 files changed

+1055
-182
lines changed

26 files changed

+1055
-182
lines changed

designer/client/components/menu/SubMenu.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ export function SubMenu({id, updateDownloadedAt}: Props) {
6868

6969
return (
7070
<div className="menu__row">
71-
<a href="/app" className="govuk-link submenu__link">
71+
<button
72+
type="button"
73+
className="govuk-body govuk-link submenu__link"
74+
onClick={() => { window.location.href = "/app"; }}
75+
>
7276
Create new form
73-
</a>
77+
</button>
7478
<button
7579
className="govuk-body govuk-link submenu__link"
7680
onClick={onClickUpload}
@@ -91,9 +95,13 @@ export function SubMenu({id, updateDownloadedAt}: Props) {
9195
onChange={onFileUpload}
9296
aria-label="Import saved form"
9397
/>
94-
<a href="/app/choose-existing" className="govuk-link submenu__link">
98+
<button
99+
type="button"
100+
className="govuk-body govuk-link submenu__link"
101+
onClick={() => { window.location.href = "/app/choose-existing"; }}
102+
>
95103
Existing forms
96-
</a>
104+
</button>
97105
</div>
98106
);
99107
}

designer/client/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from "react";
22
import ReactDOM from "react-dom";
3-
import {LandingChoice, NewConfig} from "../../digital-form-builder/designer/client/pages/LandingPage";
3+
import {NewConfig} from "../../digital-form-builder/designer/client/pages/LandingPage";
44
import {SaveError} from "../../digital-form-builder/designer/client/pages/ErrorPages";
55
import {BrowserRouter as Router, Switch, Route} from "react-router-dom";
66
import {ViewFundForms} from "./pages/landing-page";
77
import AdapterDesigner from "./AdapterDesigner";
88
import {adapterInitI18n} from "./i18n";
9+
import LandingChoice from "./pages/landing-page/ChoiceLanding";
910

1011
adapterInitI18n();
1112

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// @ts-ignore
2+
import React, { ReactElement, useState } from "react";
3+
import { i18n } from "../../i18n";
4+
import { withRouter } from "react-router-dom";
5+
//@ts-ignore
6+
import { Radios } from "@govuk-jsx/radios";
7+
import "../../../../digital-form-builder/designer/client/pages/LandingPage/LandingPage.scss";
8+
9+
interface Props {
10+
history: any;
11+
}
12+
13+
function LandingChoice({ history }: Props): ReactElement {
14+
const [createNewFrom, setCreateNewForm] = useState(true);
15+
16+
const handleNext = function () {
17+
if (createNewFrom) history.push("/new");
18+
else history.push("/choose-existing");
19+
};
20+
21+
const handleChange = (e) => {
22+
setCreateNewForm(e.target.value == "true");
23+
};
24+
25+
return (
26+
<div className="new-config">
27+
<div className="choice-wrapper">
28+
<h1 className="govuk-heading-xl govuk-heading-xl__lowmargin">
29+
{i18n("landingPage.choice.heading")}
30+
</h1>
31+
<p className="govuk-body">{i18n("landingPage.choice.intro")}</p>
32+
<Radios
33+
name="newOrExisting"
34+
value={createNewFrom}
35+
onChange={handleChange}
36+
required={true}
37+
fieldset={{
38+
legend: {
39+
isPageHeading: true,
40+
children: [i18n("landingPage.choice.hint")],
41+
},
42+
}}
43+
items={[
44+
{
45+
children: [i18n("landingPage.choice.newform")],
46+
value: true,
47+
},
48+
{
49+
children: [i18n("landingPage.choice.existing")],
50+
value: false,
51+
},
52+
]}
53+
/>
54+
<button
55+
className="govuk-button govuk-button--start"
56+
onClick={handleNext}
57+
title="Next"
58+
>
59+
{i18n("Next")}
60+
</button>
61+
</div>
62+
</div>
63+
);
64+
}
65+
66+
export default withRouter(LandingChoice);

designer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"dev": "NODE_OPTIONS=--openssl-legacy-provider && concurrently 'yarn watch' 'yarn start:local'",
88
"production": "NODE_ENV=production yarn start:server",
99
"start:test": "NODE_ENV=test yarn start:server",
10-
"build": "NODE_ENV=production && NODE_OPTIONS=--openssl-legacy-provider && webpack",
10+
"static-content:dist-push": "cp -r ../designer/public/static/images dist/client/assets && cp -r ../designer/public/static/css dist/client/assets",
11+
"build": "NODE_ENV=production && NODE_OPTIONS=--openssl-legacy-provider && webpack && yarn run static-content:dist-push",
1112
"start:server": "node dist/server.js",
1213
"start:local": "NODE_ENV=development PERSISTENT_BACKEND=preview ts-node-dev --inspect=0.0.0.0:9229 --respawn --transpile-only server/index.ts"
1314
},

designer/public/static/css/govuk-frontend-5.6.0.min.css

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
3.76 KB
Loading

designer/server/createServer.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ export async function createServer() {
7676
determinePersistenceService(config.persistentBackend, server)
7777
),
7878
]);
79+
server.ext('onPreResponse', (request, h) => {
80+
const response = h.response(request.response);
81+
response.header('Content-Security-Policy',
82+
"style-src " +
83+
"'self'" +
84+
" 'unsafe-hashes'" +
85+
" 'sha256-9/aFFbAwf+Mwl6MrBQzrJ/7ZK5vo7HdOUR7iKlBk78U='" + // color: white; filter: brightness(0) invert(1);
86+
" 'sha256-Avl+ScT4jGeaW8pHTDv8KcMb1I0qxEWb3YqO3l3VQ2g='" + // text-transform: lowercase;
87+
" 'sha256-5UVjE4ptkS47dTbf7RQHqlOoA177/uQ3ECUDPCM7iXU='" // color: white !important;
88+
);
89+
return response;
90+
});
7991
await server.register(designerPlugin);
8092
await server.register(router);
8193
await server.register(logging);

designer/server/views/head.html

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
1-
<header class="govuk-header" data-module="govuk-header">
2-
<div class="govuk-header__container">
3-
<div class="govuk-header__logo">
4-
<a href="#" class="govuk-header__link govuk-header__link--homepage">
5-
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown"
6-
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30" height="30" width="36">
7-
<path fill="currentColor" fill-rule="evenodd"
8-
d="M20.16 9.4c-.39-.94.06-2.03 1.01-2.41.93-.38 2.01.07 2.4 1.01.39.94-.06 2.01-.99 2.4-.95.39-2.03-.06-2.41-1Zm-4.86 4.25c-.95.39-1.39 1.48-1.01 2.41.39.94 1.46 1.39 2.41 1 .93-.38 1.38-1.46.99-2.4-.39-.94-1.47-1.4-2.4-1.01Zm12.22-.31c.93-.38 1.38-1.46.99-2.4-.39-.94-1.47-1.4-2.4-1.01-.95.39-1.39 1.48-1.01 2.41.39.94 1.46 1.39 2.41.99Zm.86 3.87c.39.94 1.46 1.39 2.41.99.93-.38 1.38-1.46.99-2.4-.39-.94-1.47-1.4-2.4-1.01-.95.39-1.39 1.48-1.01 2.41ZM15.02 4.68c.07.09.15.17.24.24l-1.34 4.04v.02c-.06.2-.1.42-.1.64 0 1.09.81 2 1.86 2.15h.05c.09.01.18.02.27.02.09 0 .18 0 .27-.02h.05c1.05-.16 1.86-1.06 1.86-2.15 0-.22-.03-.44-.1-.64v-.02l-1.34-4.04c.09-.07.17-.15.24-.24s2.33 1.22 2.33 1.22V2.46l-2.33.74c-.06-.09-.14-.17-.23-.24S17.69 0 17.69 0h-3.36l.94 2.95c-.08.07-.16.15-.23.24s-2.33-.73-2.33-.73V5.9l2.33-1.23ZM9.39 10.4c.95.39 2.03-.06 2.41-1 .39-.94-.06-2.03-1.01-2.41-.93-.38-2.01.07-2.4 1.01-.39.94.06 2.01.99 2.4Zm-4.94 2.95c.95.39 2.03-.06 2.41-.99.39-.94-.06-2.03-1.01-2.41-.93-.38-2.01.07-2.4 1.01-.39.94.06 2.01.99 2.4Zm-3.27 4.87c.95.39 2.03-.06 2.41-.99.39-.94-.06-2.03-1.01-2.41-.93-.38-2.01.07-2.4 1.01-.39.94.06 2.01.99 2.4ZM29.5 20.3c.25 1.27.29 1.86.01 2.68-.41-.4-.8-1.15-1.11-2.28l-1.21 4.04c.74-.51 1.31-.84 1.96-.85-1.15 2.49-2.6 3.13-3.53 2.95-1.14-.21-1.67-1.23-1.49-2.09.26-1.22 1.52-1.54 2.1-.12 1.12-2.29-.78-3-2-2.32 1.88-1.88 2.09-3.54.58-5.56-2.11 1.62-2.14 3.22-1.19 5.47-1.23-1.41-3.16-.65-2.46 1.63.89-1.38 2.07-.51 1.88.8-.16 1.14-1.66 2.06-3.54 1.9-2.69-.24-2.85-2.1-2.92-3.63.66-.12 1.85.49 2.87 1.92l.37-4.28c-1.1 1.15-2.11 1.37-3.22 1.4.37-1.16 2.08-3.05 2.08-3.05h-5.35s1.7 1.9 2.08 3.05c-1.11-.04-2.12-.25-3.22-1.4l.37 4.28c1.02-1.42 2.2-2.04 2.87-1.92-.07 1.54-.23 3.39-2.92 3.63-1.88.16-3.38-.76-3.54-1.9-.19-1.31.99-2.18 1.88-.8.69-2.28-1.23-3.04-2.46-1.63.95-2.25.93-3.85-1.19-5.47-1.52 2.02-1.3 3.68.58 5.56-1.22-.68-3.13.04-2 2.32.59-1.42 1.84-1.1 2.1.12.18.86-.35 1.88-1.49 2.09-.93.17-2.38-.47-3.53-2.95.65.02 1.22.34 1.96.85L3.61 20.7c-.31 1.13-.7 1.88-1.11 2.28-.28-.82-.24-1.41 0-2.68l-2.5.89C1.33 23 2.62 25.55 3.67 30c3.73-.53 7.91-.83 12.32-.83s8.6.3 12.33.83c1.06-4.45 2.35-7 3.67-8.81l-2.5-.89Z">
9-
</path>
10-
</svg>
11-
<span class="govuk-header__logotype-text">GOV.UK</span>
1+
<link rel="stylesheet" type="text/css" href="/assets/css/govuk-frontend-5.6.0.min.css" />
2+
3+
<header class="govuk-header govuk-header--full-width-border app-!-no-wrap" data-module="govuk-header">
4+
<div class="govuk-header__container govuk-width-container">
5+
<div class="govuk-header__logo govuk-!-margin-bottom-1">
6+
<a href="/app" class="govuk-header__link govuk-header__link--homepage">
7+
<img src="/assets/images/mhclg-crest.png" alt="MHCLG Crest" width="32" height="32"
8+
style="color: white; filter: brightness(0) invert(1);" />
9+
<span class="govuk-header__product-name">MHCLG</span>
1210
</a>
1311
</div>
1412
<div class="govuk-header__content">
15-
<form method="post" action="/logout">
16-
<span class="govuk-header__service-name"><a href="/app" class="govuk-header__link">Form Designer</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
17-
{% if authEnable and not ssoLoginUrl %}
18-
<button type="submit" class="govuk-header__link signout_button">Sign out</button>
19-
{% endif %}
20-
</span>
21-
</form>
13+
<span class="govuk-header__service-name">Form Designer</span>
14+
15+
<form id="logout-form" method="post" action="/logout">
16+
<nav class="govuk-header__navigation">
17+
<ul class="govuk-header__navigation-list">
18+
<li class="govuk-header__navigation-item govuk-header__navigation-item--active">
19+
<a
20+
href="/logout"
21+
class="govuk-header__link"
22+
style="color: white !important;"
23+
onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
24+
>
25+
Sign out
26+
</a>
27+
</li>
28+
</ul>
29+
</nav>
30+
</form>
31+
2232
</div>
2333
</div>
2434
</header>
2535

2636

2737
<div class="govuk-phase-banner">
2838
<p class="govuk-phase-banner__content">
29-
<strong class="govuk-tag govuk-phase-banner__content__tag">
30-
BETA
39+
<strong class="govuk-tag govuk-phase-banner__content__tag" style="text-transform: lowercase;">
40+
beta
3141
</strong>
3242
<span class="govuk-phase-banner__text">This is a new service. Please create your form prototypes from this service and download them as JSON configurations</span>
3343
</p>

digital-form-builder

Submodule digital-form-builder updated 59 files

runner/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"babel-build": "babel --config-file ../digital-form-builder/runner/.babelrc --extensions '.ts' ../digital-form-builder/runner/src -d dist/digital-form-builder/runner/src --copy-files -s inline",
88
"babel-build:adapter": "babel --config-file ../runner/.babelrc --extensions '.ts' ../runner/src -d dist/digital-form-builder-adapter/runner --copy-files -s inline",
99
"package-json:copy": "cp package.json dist/digital-form-builder/runner && cp package.json dist/digital-form-builder-adapter",
10-
"static-content:dist-push": "mkdir -p dist/digital-form-builder-adapter/runner/public/static && cp -r ../digital-form-builder/runner/public/static dist/digital-form-builder-adapter/runner/public",
10+
"static-content:dist-push": "mkdir -p dist/digital-form-builder-adapter/runner/public/static && cp -r ../digital-form-builder/runner/public/static dist/digital-form-builder-adapter/runner/public && cp -r ../runner/public/images dist/digital-form-builder-adapter/runner/public",
1111
"scss:build": "node compile-scss.js",
1212
"copy-forms": "node copy-form-json.js",
1313
"clean:build": "rm -rf dist",
@@ -30,6 +30,7 @@
3030
"@aws-sdk/s3-request-presigner": "3.633.0",
3131
"@sentry/node": "^8.47.0",
3232
"dropzone": "5.9.3",
33+
"govuk-frontend": "^5.10.2",
3334
"hapi-i18n": "3.0.1",
3435
"joi": "17.13.3",
3536
"tinymce": "7.3.0"

0 commit comments

Comments
 (0)