forked from id-sk/id-sk-frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explains that the review application is not official guidance.
- Loading branch information
1 parent
8723dff
commit 6cf98c7
Showing
11 changed files
with
108 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ $govuk-show-breakpoints: true; | |
|
||
@import "../../../src/all"; | ||
@import "partials/app"; | ||
@import "partials/banner"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
.app-banner { | ||
font-family: sans-serif; | ||
font-size: 2rem; | ||
line-height: 1.5; | ||
overflow: hidden; | ||
padding-bottom: govuk-spacing(6); | ||
padding-top: govuk-spacing(6); | ||
|
||
.app-banner__button { | ||
margin-bottom: 0; | ||
} | ||
|
||
.govuk-body { | ||
color: inherit; | ||
font-size: inherit; | ||
} | ||
|
||
.govuk-link:not(:focus) { | ||
color: inherit; | ||
} | ||
} | ||
|
||
.app-banner--hidden { | ||
display: none; | ||
} | ||
|
||
.app-banner--warning { | ||
background: govuk-colour('red'); | ||
color: govuk-colour('white'); | ||
|
||
.app-banner__button, | ||
.app-banner__button:active, | ||
.app-banner__button:hover, | ||
.app-banner__button:focus { | ||
background: govuk-colour('white'); | ||
box-shadow: 0 2px 0 $govuk-text-colour; | ||
color: $govuk-text-colour; | ||
margin-bottom: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const cookieParser = require('cookie-parser') | ||
|
||
const BANNER_COOKIE_NAME = 'dismissed-app-banner' | ||
|
||
module.exports = function (app) { | ||
// Detect if banner should be shown based on cookies set | ||
app.use(cookieParser()) | ||
app.use(function (request, response, next) { | ||
let cookie = request.cookies[BANNER_COOKIE_NAME] | ||
|
||
if (cookie === 'yes') { | ||
app.locals.shouldShowAppBanner = false | ||
return next() | ||
} | ||
|
||
app.locals.shouldShowAppBanner = true | ||
|
||
next() | ||
}) | ||
|
||
app.post('/hide-banner', async function (request, response) { | ||
let maxAgeInDays = 28 | ||
response.cookie(BANNER_COOKIE_NAME, 'yes', { | ||
maxAge: maxAgeInDays * 24 * 60 * 60 * 1000, | ||
httpOnly: true | ||
}) | ||
// Redirect to where the user POSTed from. | ||
let previousURL = request.header('Referer') || '/' | ||
response.redirect(previousURL) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="app-banner app-banner--warning {{ "app-banner--hidden" if not shouldShowAppBanner }}" data-module="app-banner"> | ||
<div class="govuk-width-container"> | ||
<p class="govuk-body"> | ||
This is not a real service, and is used for testing purposes only. | ||
<br> | ||
See the <a class="govuk-link" href="https://design-system.service.gov.uk/">GOV.UK Design System</a> for recommended guidance. | ||
</p> | ||
<form method="post" action="/hide-banner"> | ||
<button class="govuk-button app-banner__button">Hide this banner</button> | ||
</form> | ||
</div> | ||
</div> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters