From 5556e689ada6f2c3260d63b08266da8542fee384 Mon Sep 17 00:00:00 2001 From: Cameron Lamb Date: Mon, 24 Feb 2025 13:43:42 +0000 Subject: [PATCH 1/2] WIP modal changes --- .../templates/tags/sidebar/parts/share.html | 4 +- .../dwds/components/modal.html | 4 +- src/dw_design_system/dwds/components/modal.js | 12 ++ .../dwds/components/modal.scss | 12 +- .../dwds/styles/variables.scss | 17 ++- src/dw_design_system/utils.py | 2 +- src/feedback/templates/feedback.html | 132 ++++++++++-------- 7 files changed, 107 insertions(+), 76 deletions(-) diff --git a/src/core/templates/tags/sidebar/parts/share.html b/src/core/templates/tags/sidebar/parts/share.html index 9e59d6ada..5394f813b 100644 --- a/src/core/templates/tags/sidebar/parts/share.html +++ b/src/core/templates/tags/sidebar/parts/share.html @@ -7,10 +7,10 @@
- {% include "dwds/components/copy_text.html" with text=page_url %}
- +
+ {% include "dwds/components/copy_text.html" with text=page_url %}
diff --git a/src/dw_design_system/dwds/components/modal.html b/src/dw_design_system/dwds/components/modal.html index 65240e383..4ce8a2504 100644 --- a/src/dw_design_system/dwds/components/modal.html +++ b/src/dw_design_system/dwds/components/modal.html @@ -2,9 +2,9 @@
- {{ content }}
- +
+ {{ content }}
diff --git a/src/dw_design_system/dwds/components/modal.js b/src/dw_design_system/dwds/components/modal.js index 461c4a72d..1d66092aa 100644 --- a/src/dw_design_system/dwds/components/modal.js +++ b/src/dw_design_system/dwds/components/modal.js @@ -10,5 +10,17 @@ document.addEventListener('DOMContentLoaded', function () { closeElement.addEventListener("click", function () { dialog.close(); }); + dialog.addEventListener('click', function (event) { + const rect = dialog.getBoundingClientRect(); + const isInDialog = ( + rect.top <= event.clientY + && event.clientY <= rect.top + rect.height + && rect.left <= event.clientX + && event.clientX <= rect.left + rect.width + ); + if (!isInDialog) { + dialog.close(); + } + }); }); }); \ No newline at end of file diff --git a/src/dw_design_system/dwds/components/modal.scss b/src/dw_design_system/dwds/components/modal.scss index eec172aca..e8444da6c 100644 --- a/src/dw_design_system/dwds/components/modal.scss +++ b/src/dw_design_system/dwds/components/modal.scss @@ -1,8 +1,16 @@ .dwds-modal { dialog { + border: unset; + border-radius: var(--border-radius); + &::backdrop { - background: rgba(36, 32, 20, 0.5); - backdrop-filter: blur(0.25rem); + background: var(--modal-backdrop-color); + backdrop-filter: blur(0.3rem); + } + + form[method="dialog"] { + display: flex; + flex-direction: row-reverse; } } diff --git a/src/dw_design_system/dwds/styles/variables.scss b/src/dw_design_system/dwds/styles/variables.scss index bca212957..aabe23ad2 100644 --- a/src/dw_design_system/dwds/styles/variables.scss +++ b/src/dw_design_system/dwds/styles/variables.scss @@ -10,13 +10,13 @@ --dbt-miuk-light-grey: #dde5ed; --dbt-background-blue: #d2e2f1; --dbt-very-light-grey: #EEEFEF; - --dbt-dark-teel:#004D44; - --dbt-light-green:#CCE2D8; - --dbt-black:#000000; - --dbt-light-pink:#FCD6C3; - --dbt-burnt-orange:#E24912; - --dbt-light-purple:#DBD5E9; - --dbt-dark-purple:#4814A0; + --dbt-dark-teel: #004D44; + --dbt-light-green: #CCE2D8; + --dbt-black: #000000; + --dbt-light-pink: #FCD6C3; + --dbt-burnt-orange: #E24912; + --dbt-light-purple: #DBD5E9; + --dbt-dark-purple: #4814A0; // GDS colours - for re-use in this file only // https://design-system.service.gov.uk/styles/colour/#colour-palette @@ -160,4 +160,7 @@ --card-bg-white: var(--dbt-white); --card-bg-blue: var(--dbt-blue); --card-bg-red: var(--dbt-red); + + // Modal + --modal-backdrop-color: rgba(0, 0, 0, 0.6); } \ No newline at end of file diff --git a/src/dw_design_system/utils.py b/src/dw_design_system/utils.py index 1bc7c10bc..5de14acec 100644 --- a/src/dw_design_system/utils.py +++ b/src/dw_design_system/utils.py @@ -257,7 +257,7 @@ def get_dwds_templates(template_type, request: HttpRequest): "name": "Modal", "template": "dwds/components/modal.html", "context": { - "content": "https://www.gov.uk", + "content": "MODAL CONTENT", }, }, ], diff --git a/src/feedback/templates/feedback.html b/src/feedback/templates/feedback.html index 3fc310e02..84402f30e 100644 --- a/src/feedback/templates/feedback.html +++ b/src/feedback/templates/feedback.html @@ -30,78 +30,86 @@ +
+ +
From ce144fb4fb2a0a0161c66a484d0d2d338a2dc64d Mon Sep 17 00:00:00 2001 From: Cameron Lamb Date: Mon, 24 Feb 2025 14:04:03 +0000 Subject: [PATCH 2/2] More tweaks to the modal and the components used --- .../templates/tags/sidebar/parts/share.html | 5 +++- .../dwds/components/modal.html | 5 +++- .../dwds/components/modal.scss | 5 ++++ .../dwds/elements/button.scss | 28 +++++++++++++++++++ src/dw_design_system/dwds/icons/cross.html | 10 +++++++ src/dw_design_system/dwds/icons/cross.scss | 5 ++++ src/dw_design_system/dwds/stylesheet.scss | 9 +++--- .../templates/dw_design_system/styles.html | 26 ++++++++++++----- src/feedback/templates/feedback.html | 5 +++- 9 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 src/dw_design_system/dwds/icons/cross.html create mode 100644 src/dw_design_system/dwds/icons/cross.scss diff --git a/src/core/templates/tags/sidebar/parts/share.html b/src/core/templates/tags/sidebar/parts/share.html index 5394f813b..b0805404d 100644 --- a/src/core/templates/tags/sidebar/parts/share.html +++ b/src/core/templates/tags/sidebar/parts/share.html @@ -8,7 +8,10 @@
- +
{% include "dwds/components/copy_text.html" with text=page_url %}
diff --git a/src/dw_design_system/dwds/components/modal.html b/src/dw_design_system/dwds/components/modal.html index 4ce8a2504..487d38d09 100644 --- a/src/dw_design_system/dwds/components/modal.html +++ b/src/dw_design_system/dwds/components/modal.html @@ -3,7 +3,10 @@
- +
{{ content }}
diff --git a/src/dw_design_system/dwds/components/modal.scss b/src/dw_design_system/dwds/components/modal.scss index e8444da6c..1c874f13b 100644 --- a/src/dw_design_system/dwds/components/modal.scss +++ b/src/dw_design_system/dwds/components/modal.scss @@ -11,6 +11,11 @@ form[method="dialog"] { display: flex; flex-direction: row-reverse; + + button { + // color: var(--color-link); + } + } } diff --git a/src/dw_design_system/dwds/elements/button.scss b/src/dw_design_system/dwds/elements/button.scss index 64eda33ea..556163a13 100644 --- a/src/dw_design_system/dwds/elements/button.scss +++ b/src/dw_design_system/dwds/elements/button.scss @@ -29,6 +29,7 @@ a.dwds-button, } + &--link, &--clear-icon, &--clear { // Unset the default button styling @@ -133,6 +134,33 @@ a.dwds-button, padding: var(--padding-button-inline); } + &--link { + color: var(--color-link); + + &.no-underline { + text-decoration: none; + } + + &.no-underline:focus, + &.no-underline:active, + &:focus, + &:active { + text-decoration: underline var(--text-underline-hover); + background-color: var(--color-link-background-active); + color: var(--color-text); + } + + &.no-underline:focus-visible, + &:focus-visible { + outline: none; + } + + &.no-underline:hover, + &:hover { + text-decoration: underline var(--text-underline-hover); + } + } + &--navigation { padding: var(--padding-button-inline); color: var(--color-button-secondary-dark-text); diff --git a/src/dw_design_system/dwds/icons/cross.html b/src/dw_design_system/dwds/icons/cross.html new file mode 100644 index 000000000..789cea0d2 --- /dev/null +++ b/src/dw_design_system/dwds/icons/cross.html @@ -0,0 +1,10 @@ +{% load dwds_icons %} + + + + diff --git a/src/dw_design_system/dwds/icons/cross.scss b/src/dw_design_system/dwds/icons/cross.scss new file mode 100644 index 000000000..d2566e809 --- /dev/null +++ b/src/dw_design_system/dwds/icons/cross.scss @@ -0,0 +1,5 @@ +.cross-icon { + path { + fill: currentColor; + } +} \ No newline at end of file diff --git a/src/dw_design_system/dwds/stylesheet.scss b/src/dw_design_system/dwds/stylesheet.scss index e951de854..0a8e87aba 100644 --- a/src/dw_design_system/dwds/stylesheet.scss +++ b/src/dw_design_system/dwds/stylesheet.scss @@ -50,16 +50,17 @@ // Icons @forward "icons/bookmark"; +@forward "icons/celebrate"; +@forward "icons/check"; @forward "icons/comment"; -@forward "icons/share"; @forward "icons/copy"; -@forward "icons/check"; -@forward "icons/celebrate"; +@forward "icons/cross"; @forward "icons/dislike"; +@forward "icons/feedback"; @forward "icons/like"; @forward "icons/love"; +@forward "icons/share"; @forward "icons/unhappy"; -@forward "icons/feedback"; // Layouts @forward "layouts/content_sidebar"; diff --git a/src/dw_design_system/templates/dw_design_system/styles.html b/src/dw_design_system/templates/dw_design_system/styles.html index 576ccb3c9..4b100bead 100644 --- a/src/dw_design_system/templates/dw_design_system/styles.html +++ b/src/dw_design_system/templates/dw_design_system/styles.html @@ -107,6 +107,25 @@

Buttons

+

Navigation buttons

+ +
+ + +
+ +

Buttons as links

+ + + +

Links

+ + +

Links as buttons

@@ -129,13 +148,6 @@

Links as buttons

CB (inline)
-

Navigation buttons

- -
- - -
-

Links as Navigation buttons

diff --git a/src/feedback/templates/feedback.html b/src/feedback/templates/feedback.html index 84402f30e..611b59303 100644 --- a/src/feedback/templates/feedback.html +++ b/src/feedback/templates/feedback.html @@ -34,7 +34,10 @@