From e4c3ff25dfbdeae4ac3dc072ea86efd81ec57a12 Mon Sep 17 00:00:00 2001 From: Cameron Lamb Date: Tue, 8 Oct 2024 12:14:19 +0100 Subject: [PATCH 1/4] Component refactor (#765) --- assets/stylesheets/components/_home_new.scss | 5 +- .../components/_streamfield-content.scss | 40 ++- .../templates/content/navigation_page.html | 10 +- src/core/templates/dwds_content.html | 12 +- .../dwds/components/__init__.py | 3 +- .../dwds/components/banner.html | 11 + .../dwds/components/banner_card.html | 30 --- .../dwds/components/banner_card.scss | 13 - src/dw_design_system/dwds/components/box.html | 1 + src/dw_design_system/dwds/components/box.scss | 3 + .../dwds/components/card_group.html | 44 ---- .../dwds/components/card_group.scss | 38 --- .../dwds/components/comment_section.html | 8 + .../dwds/components/comment_section.scss | 5 + .../dwds/components/content_list.html | 23 ++ .../dwds/components/content_list.scss | 32 +++ src/dw_design_system/dwds/components/cta.html | 6 + .../dwds/components/cta_card.html | 18 +- .../dwds/components/cta_card.py | 33 +++ .../dwds/components/engagement.html | 45 ++++ .../dwds/components/engagement_card.html | 60 ----- .../dwds/components/engagement_card.scss | 3 - .../dwds/components/link_action.html | 10 + .../dwds/components/link_action.scss | 26 ++ .../dwds/components/link_list.html | 42 ++- .../dwds/components/link_navigate.html | 13 +- .../dwds/components/link_navigate.scss | 8 +- .../dwds/components/navigation_card.html | 17 -- .../dwds/components/navigation_card.py | 35 --- .../dwds/components/navigation_card.scss | 1 - .../dwds/components/one_up.html | 43 ++++ .../dwds/components/one_up.scss | 17 ++ .../dwds/components/one_up_card.html | 60 ----- .../dwds/components/one_up_card.scss | 7 - .../dwds/components/promo.html | 64 ++--- .../dwds/components/promo.scss | 35 +-- .../dwds/elements/content_header.html | 5 + .../dwds/elements/content_header.scss | 18 ++ .../dwds/elements/content_image.html | 11 + .../dwds/elements/content_image.scss | 7 + .../dwds/elements/content_item.html | 5 + .../dwds/elements/content_item.scss | 4 + .../dwds/elements/content_main.html | 17 ++ .../dwds/elements/content_main.scss | 86 +++++++ .../dwds/elements/extendable/card.html | 46 ---- .../dwds/elements/extendable/card.scss | 181 ------------- .../dwds/elements/information_panel.scss | 23 -- src/dw_design_system/dwds/elements/ribbon.js | 13 + .../dwds/elements/ribbon.scss | 20 +- .../dwds/layouts/content_custom_sidebar.html | 12 + .../dwds/layouts/content_custom_sidebar.scss | 49 ++++ .../dwds/layouts/content_grid.html | 3 + .../dwds/layouts/content_grid.scss | 59 +++++ .../dwds/layouts/content_item_card.html | 1 + .../dwds/layouts/content_item_card.scss | 17 ++ .../dwds/layouts/content_sidebar.html | 3 + .../dwds/layouts/content_sidebar.scss | 35 +++ .../dwds/layouts/content_stack.html | 3 + .../dwds/layouts/content_stack.scss | 19 ++ .../dwds/layouts/content_switcher.html | 3 + .../dwds/layouts/content_switcher.scss | 20 ++ .../dwds/styles/layout-primitives.scss | 52 ---- src/dw_design_system/dwds/styles/layout.scss | 47 +--- .../dwds/styles/temporary-base.scss | 21 +- .../dwds/styles/variables.scss | 2 - src/dw_design_system/dwds/stylesheet.scss | 27 +- src/dw_design_system/dwds/utils.scss | 31 +++ .../{components.html => dwds_components.html} | 8 +- .../templates/dw_design_system/layouts.html | 20 ++ .../dw_design_system/partials/component.html | 2 +- .../templatetags/dw_design_system.py | 1 - src/dw_design_system/urls.py | 30 ++- src/dw_design_system/utils.py | 241 ++++++++++-------- src/dw_design_system/views.py | 97 +++++-- src/events/templates/events/event_page.html | 142 ++++++----- .../events/includes/listing_header.html | 37 +++ src/home/templates/home/home_page.html | 65 +++-- src/home/templatetags/cards.py | 61 ++++- .../templates/interactions/bookmark_card.html | 33 +-- src/news/templates/news/news_page.html | 10 +- 80 files changed, 1310 insertions(+), 1098 deletions(-) create mode 100644 src/dw_design_system/dwds/components/banner.html delete mode 100644 src/dw_design_system/dwds/components/banner_card.html delete mode 100644 src/dw_design_system/dwds/components/banner_card.scss create mode 100644 src/dw_design_system/dwds/components/box.html create mode 100644 src/dw_design_system/dwds/components/box.scss delete mode 100644 src/dw_design_system/dwds/components/card_group.html delete mode 100644 src/dw_design_system/dwds/components/card_group.scss create mode 100644 src/dw_design_system/dwds/components/comment_section.html create mode 100644 src/dw_design_system/dwds/components/comment_section.scss create mode 100644 src/dw_design_system/dwds/components/content_list.html create mode 100644 src/dw_design_system/dwds/components/content_list.scss create mode 100644 src/dw_design_system/dwds/components/cta.html create mode 100644 src/dw_design_system/dwds/components/engagement.html delete mode 100644 src/dw_design_system/dwds/components/engagement_card.html delete mode 100644 src/dw_design_system/dwds/components/engagement_card.scss create mode 100644 src/dw_design_system/dwds/components/link_action.html create mode 100644 src/dw_design_system/dwds/components/link_action.scss delete mode 100644 src/dw_design_system/dwds/components/navigation_card.html delete mode 100644 src/dw_design_system/dwds/components/navigation_card.py delete mode 100644 src/dw_design_system/dwds/components/navigation_card.scss create mode 100644 src/dw_design_system/dwds/components/one_up.html create mode 100644 src/dw_design_system/dwds/components/one_up.scss delete mode 100644 src/dw_design_system/dwds/components/one_up_card.html delete mode 100644 src/dw_design_system/dwds/components/one_up_card.scss create mode 100644 src/dw_design_system/dwds/elements/content_header.html create mode 100644 src/dw_design_system/dwds/elements/content_header.scss create mode 100644 src/dw_design_system/dwds/elements/content_image.html create mode 100644 src/dw_design_system/dwds/elements/content_image.scss create mode 100644 src/dw_design_system/dwds/elements/content_item.html create mode 100644 src/dw_design_system/dwds/elements/content_item.scss create mode 100644 src/dw_design_system/dwds/elements/content_main.html create mode 100644 src/dw_design_system/dwds/elements/content_main.scss delete mode 100644 src/dw_design_system/dwds/elements/extendable/card.html delete mode 100644 src/dw_design_system/dwds/elements/extendable/card.scss delete mode 100644 src/dw_design_system/dwds/elements/information_panel.scss create mode 100644 src/dw_design_system/dwds/elements/ribbon.js create mode 100644 src/dw_design_system/dwds/layouts/content_custom_sidebar.html create mode 100644 src/dw_design_system/dwds/layouts/content_custom_sidebar.scss create mode 100644 src/dw_design_system/dwds/layouts/content_grid.html create mode 100644 src/dw_design_system/dwds/layouts/content_grid.scss create mode 100644 src/dw_design_system/dwds/layouts/content_item_card.html create mode 100644 src/dw_design_system/dwds/layouts/content_item_card.scss create mode 100644 src/dw_design_system/dwds/layouts/content_sidebar.html create mode 100644 src/dw_design_system/dwds/layouts/content_sidebar.scss create mode 100644 src/dw_design_system/dwds/layouts/content_stack.html create mode 100644 src/dw_design_system/dwds/layouts/content_stack.scss create mode 100644 src/dw_design_system/dwds/layouts/content_switcher.html create mode 100644 src/dw_design_system/dwds/layouts/content_switcher.scss create mode 100644 src/dw_design_system/dwds/utils.scss rename src/dw_design_system/templates/dw_design_system/{components.html => dwds_components.html} (89%) create mode 100644 src/dw_design_system/templates/dw_design_system/layouts.html create mode 100644 src/events/templates/events/includes/listing_header.html diff --git a/assets/stylesheets/components/_home_new.scss b/assets/stylesheets/components/_home_new.scss index 7df98ef43..052927df4 100644 --- a/assets/stylesheets/components/_home_new.scss +++ b/assets/stylesheets/components/_home_new.scss @@ -55,12 +55,13 @@ } // Adds spacing to the top level content when a flag banner is not present. - .dwds > .stack > :not(.govuk-phase-banner) { + .dwds > .content-stack > :not(.govuk-phase-banner) { margin-block-start: var(--space); } } .new-home { + article, section { display: inline; @@ -81,4 +82,4 @@ margin-bottom: 10px; } } -} +} \ No newline at end of file diff --git a/assets/stylesheets/components/_streamfield-content.scss b/assets/stylesheets/components/_streamfield-content.scss index a9b2ba700..a607199fc 100644 --- a/assets/stylesheets/components/_streamfield-content.scss +++ b/assets/stylesheets/components/_streamfield-content.scss @@ -10,7 +10,8 @@ @include govuk-font($size: 16, $weight: bold); } - p, li { + p, + li { @extend %govuk-body-m; } @@ -29,30 +30,19 @@ } table { - @extend .govuk-table; + @extend .govuk-table; - caption { - @extend .govuk-table__caption; - } + caption { + @extend .govuk-table__caption; + } - th { - @extend .govuk-table__header; - } + th { + @extend .govuk-table__header; + } - td { - @extend .govuk-table__cell; - } - } -} - -.ws-streamfield-content__image { - margin: 0 0 govuk-spacing(3) 0; - padding: 0; - display: table; - - img { - max-width: 100%; - height: auto; + td { + @extend .govuk-table__cell; + } } } @@ -71,8 +61,10 @@ .ws-streamfield-content__cta-link-container { padding-top: govuk-spacing(2); - a, a:visited { + + a, + a:visited { color: $govuk-text-colour; padding: govuk-spacing(4); } -} +} \ No newline at end of file diff --git a/src/content/templates/content/navigation_page.html b/src/content/templates/content/navigation_page.html index 994d2eab4..214ef6a51 100644 --- a/src/content/templates/content/navigation_page.html +++ b/src/content/templates/content/navigation_page.html @@ -4,7 +4,7 @@ {% block body_classes %}dwds-body dwds-navigation-page{% endblock %} {% block page_title %} -
+