From deff3d5c8f429aa2b61b5d9621fad4a4ac7840c4 Mon Sep 17 00:00:00 2001 From: Sergii Pavlenko Date: Mon, 5 Jul 2021 19:21:10 +0300 Subject: [PATCH 1/8] EWPP-1277: Port CSS for recreating contextual navigation composition inside ECL3. --- sass/components/_contextual_navigation.scss | 85 +++++++++++++++++++ .../_contextual_navigation_print.scss | 39 +++++++++ sass/print.scss | 5 +- sass/style-ec.scss | 1 + sass/style-eu.scss | 1 + 5 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 sass/components/_contextual_navigation.scss create mode 100644 sass/components/_contextual_navigation_print.scss diff --git a/sass/components/_contextual_navigation.scss b/sass/components/_contextual_navigation.scss new file mode 100644 index 000000000..3b66f73b5 --- /dev/null +++ b/sass/components/_contextual_navigation.scss @@ -0,0 +1,85 @@ +@use "sass:map"; +@use '@ecl/theme-dev/theme'; +@use '@ecl/vanilla-layout-grid/mixins/breakpoints'; + +.ecl-contextual-navigation { + display: flex; + flex-direction: column; + margin: 0; +} + +.ecl-contextual-navigation__label { + color: map.get(theme.$color, 'black-100'); + font: map.get(theme.$font, 'm'); +} + +.ecl-contextual-navigation__list { + display: flex; + flex-wrap: wrap; + list-style: none; + margin-bottom: 0; + margin-top: map.get(theme.$spacing, 's'); + padding-left: 0; +} + +.ecl-contextual-navigation__item { + border-right: 1px solid map.get(theme.$color, 'grey-50'); + display: block; + margin-right: map.get(theme.$spacing, 's'); + padding-right: map.get(theme.$spacing, 's'); +} + +.ecl-contextual-navigation__item:last-child { + border-right-width: 0; + margin-right: 0; + padding-right: 0; +} + +.ecl-contextual-navigation__item--collapsed { + display: none; + + .no-js & { + display: block; + } +} + +.ecl-contextual-navigation__item--more { + .no-js & { + display: none; + } +} + +.ecl-contextual-navigation__list[aria-expanded='true'] { + .ecl-contextual-navigation__item--collapsed { + display: block; + } +} + +.ecl-contextual-navigation__more { + font-weight: map.get(theme.$font, 'weight-regular'); + line-height: 1; + padding: 0; + + &:hover { + color: map.get(theme.$color, 'black-100'); + } + + &:focus { + color: map.get(theme.$color, 'black-100'); + outline-offset: 2px; + } +} + +@include breakpoints.up('sm') { + .ecl-contextual-navigation { + flex-direction: row; + } + + .ecl-contextual-navigation__label { + margin-right: map.get(theme.$spacing, '4xl'); + } + + .ecl-contextual-navigation__list { + margin-top: 0; + } +} diff --git a/sass/components/_contextual_navigation_print.scss b/sass/components/_contextual_navigation_print.scss new file mode 100644 index 000000000..78a0d021d --- /dev/null +++ b/sass/components/_contextual_navigation_print.scss @@ -0,0 +1,39 @@ +@use "sass:map"; +@use '@ecl/theme-dev/theme'; + +.ecl-contextual-navigation { + display: flex; + flex-direction: row; + margin: 0; +} + +.ecl-contextual-navigation__label { + color: map.get(theme.$color, 'black-100'); + font: map.get(theme.$font-print, 'm'); + margin-right: map.get(theme.$spacing-print, 'xl'); +} + +.ecl-contextual-navigation__list { + display: flex; + flex-direction: column; + list-style: none; + padding-left: 0; + margin: 0; +} + +.ecl-contextual-navigation__item { + border-right: 1px solid map.get(theme.$color, 'grey-50'); + display: block; + margin-right: map.get(theme.$spacing, 's'); + padding-right: map.get(theme.$spacing, 's'); +} + +.ecl-contextual-navigation__item:last-child { + border-right-width: 0; + margin-right: 0; + padding-right: 0; +} + +.ecl-contextual-navigation__item--more { + display: none; +} diff --git a/sass/print.scss b/sass/print.scss index 48474a34a..2bc821d1b 100644 --- a/sass/print.scss +++ b/sass/print.scss @@ -1,6 +1,3 @@ // Style adjustment for print version. -// Workaround which should be removed after the release of Webtools with https://citnet.tech.ec.europa.eu/CITnet/jira/browse/WEBTOOLS-12842. -#globan, #cookie-consent-banner { - display: none; -} +@use "./components/_contextual_navigation_print"; diff --git a/sass/style-ec.scss b/sass/style-ec.scss index 88c8e0002..553edb7c8 100644 --- a/sass/style-ec.scss +++ b/sass/style-ec.scss @@ -14,3 +14,4 @@ @use "./components/description_list"; @use "./components/media_iframe"; @use "./components/expandable"; +@use "./components/_contextual_navigation"; diff --git a/sass/style-eu.scss b/sass/style-eu.scss index d0d6fabd4..b2fe3f31a 100644 --- a/sass/style-eu.scss +++ b/sass/style-eu.scss @@ -19,3 +19,4 @@ @use "./components/description_list"; @use "./components/media_iframe"; @use "./components/expandable"; +@use "./components/_contextual_navigation"; From e02118777a7b0dc6c0116adbbcf6d013ce9eff87 Mon Sep 17 00:00:00 2001 From: Sergii Pavlenko Date: Mon, 5 Jul 2021 19:22:19 +0300 Subject: [PATCH 2/8] EWPP-1277: Adjust contextual navigation pattern. --- .../contextual-navigation.html.twig | 3 --- templates/patterns/context_nav/context_nav.ui_patterns.yml | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/compositions/ec-component-contextual-navigation/contextual-navigation.html.twig b/templates/compositions/ec-component-contextual-navigation/contextual-navigation.html.twig index b52e0faf3..763dcd3d2 100644 --- a/templates/compositions/ec-component-contextual-navigation/contextual-navigation.html.twig +++ b/templates/compositions/ec-component-contextual-navigation/contextual-navigation.html.twig @@ -44,9 +44,6 @@ class="{{ _css_class }}"{{ _extra_attributes|raw }} data-ecl-contextual-navigation - {# Prevent initialization for the moment #} - {# TODO: Deprecate or reinstate the component. #} - {# data-ecl-auto-init="ContextualNavigation" #} >
{{ _label }}