Skip to content

Commit

Permalink
PLATUI-3404: Updated index page for styling, updated timeout dialog, …
Browse files Browse the repository at this point in the history
…correct focus style on timeout-dialog (#421)

Co-authored-by: Niall Molloy <[email protected]>
  • Loading branch information
JoPintoPaul and gunjam authored Jan 8, 2025
1 parent 8bf6b9d commit 2f2dbc3
Show file tree
Hide file tree
Showing 27 changed files with 28 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [6.50.0] - 2025-01-08

### Changed

- Styled `timeout-dialog` call to action as button and other visual improvement (with thanks to [@gunjam](https://github.com/gunjam) for this contribution)
- Added correct styling to links on app index page (with thanks to [@gunjam](https://github.com/gunjam) for this contribution)

## [6.49.0] - 2025-01-06

### Changed
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p class="govuk-body">Follow the links under sub headings below to view examples of the components.</p>
{% for componentName in componentsDirectory | sort %}
<h3 class="govuk-heading-s">{{ componentName | replace("-", " ") | capitalize }}</h3>
<p class="govuk-body"><a href="/components/{{ componentName }}">View the readme</a>, or browse the examples:</p>
<p class="govuk-body"><a class="govuk-link" href="/components/{{ componentName }}">View the readme</a>, or browse the examples:</p>
<ul class="govuk-list govuk-list--bullet">
{% for exampleName in componentName | componentExamples %}
<li><a href="/components/{{ componentName }}/{{ exampleName }}/preview" class="govuk-link">{{ exampleName | replace("-", " ") | capitalize }} example</a></li>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hmrc-frontend",
"version": "6.49.0",
"version": "6.50.0",
"description": "Design patterns for HMRC frontends",
"scripts": {
"start": "gulp dev",
Expand Down
20 changes: 6 additions & 14 deletions src/components/timeout-dialog/_timeout-dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ html {
@include govuk-media-query($from: tablet) {
width: 435px;
}

&:focus {
outline: $govuk-focus-width solid $govuk-focus-colour;
}
}

.hmrc-timeout-dialog__message {
Expand All @@ -52,25 +56,13 @@ html {
white-space: nowrap;
}

.hmrc-timeout-dialog__link-wrapper {
@include govuk-media-query($from: tablet) {
display: inline-block;
line-height: 2.5em;
vertical-align: baseline;
}
}

.hmrc-timeout-dialog__link {
@include govuk-font($size: 24);

display: inline-block;

@include govuk-media-query($from: tablet) {
@include govuk-font($size: 19);

position: relative;
top: 2px;
padding: 0.526315em 0.789473em 0.263157em;
line-height: 1.5;
// Same padding as govuk-button
padding: (govuk-spacing(2) - $govuk-border-width-form-element) govuk-spacing(2) (govuk-spacing(2) - $govuk-border-width-form-element - ($govuk-border-width-form-element / 2));
}
}
17 changes: 7 additions & 10 deletions src/components/timeout-dialog/timeout-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,6 @@ function TimeoutDialog($module, $sessionActivityService) {
});
};

const wrapLink = ($elem) => {
const $wrapper = document.createElement('div');
$wrapper.classList.add('hmrc-timeout-dialog__link-wrapper');
$wrapper.appendChild($elem);

return $wrapper;
};

const setupDialog = (signoutTime) => {
const $element = utils.generateDomElementFromString('<div>');

Expand Down Expand Up @@ -181,9 +173,12 @@ function TimeoutDialog($module, $sessionActivityService) {
settings.keepAliveButtonText,
);

const $wrapper = document.createElement('div');
$wrapper.classList.add('govuk-button-group');
$wrapper.appendChild($staySignedInButton);

$element.appendChild($visualMessge);
$element.appendChild($audibleMessage);
$element.appendChild($staySignedInButton);
$staySignedInButton.addEventListener('click', keepAliveAndClose);
$element.appendChild(document.createTextNode(' '));

Expand All @@ -195,9 +190,11 @@ function TimeoutDialog($module, $sessionActivityService) {
$signOutButton.addEventListener('click', signOut);
$signOutButton.setAttribute('href', settings.signOutUrl);

$element.appendChild(wrapLink($signOutButton));
$wrapper.appendChild($signOutButton);
}

$element.appendChild($wrapper);

const dialogControl = dialog.displayDialog($element);

cleanupFunctions.push(() => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/timeout-dialog/timeout-dialog.jsdom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ describe('/components/timeout-dialog', () => {
expect(testScope.latestDialog$element.querySelector('#hmrc-timeout-sign-out-link').innerText).toEqual('Sign out');
});

it('should separate the call-to-actions into different containers', () => {
expect(testScope.latestDialog$element.querySelector('button#hmrc-timeout-keep-signin-btn.govuk-button').parentNode).not.toBe(testScope.latestDialog$element.querySelector('#hmrc-timeout-sign-out-link').parentNode);
it('should add the call-to-actions into a shared button-group container', () => {
const group = testScope.latestDialog$element.querySelector('.govuk-button-group');
expect(testScope.latestDialog$element.querySelector('button#hmrc-timeout-keep-signin-btn.govuk-button').parentNode).toBe(group);
expect(testScope.latestDialog$element.querySelector('#hmrc-timeout-sign-out-link').parentNode).toBe(group);
});

it('should redirect to sign out url when sign out is clicked', () => {
Expand Down

0 comments on commit 2f2dbc3

Please sign in to comment.