Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEL-1160: Header refactor. #71

Merged
merged 40 commits into from
Mar 14, 2022
Merged

OEL-1160: Header refactor. #71

merged 40 commits into from
Mar 14, 2022

Conversation

escuriola
Copy link
Contributor

@escuriola escuriola commented Feb 16, 2022

https://citnet.tech.ec.europa.eu/CITnet/jira/browse/OEL-1160

oe_bootstrap_theme changes are requested to manage BCL EU/EC logos

@escuriola escuriola force-pushed the OEL-1160 branch 2 times, most recently from 123e223 to e5ec342 Compare February 21, 2022 14:48
Copy link
Contributor

@drishu drishu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somethings not right in mobile view
Screenshot 2022-02-22 at 09 44 35

oe_whitelabel.theme Outdated Show resolved Hide resolved
tests/src/Kernel/SiteBrandingBlockTest.php Outdated Show resolved Hide resolved
Copy link
Contributor

@drishu drishu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to add the new tag for the new logo location in OEBT

oe_whitelabel.theme Show resolved Hide resolved
tests/src/Functional/CorporateHeaderLogosTest.php Outdated Show resolved Hide resolved
tests/src/Kernel/SiteBrandingBlockTest.php Outdated Show resolved Hide resolved
tests/src/Kernel/SiteBrandingBlockTest.php Outdated Show resolved Hide resolved
tests/src/Kernel/SiteBrandingBlockTest.php Show resolved Hide resolved
tests/src/Kernel/SiteBrandingBlockTest.php Show resolved Hide resolved
drishu
drishu previously approved these changes Feb 23, 2022
{% set name_classes = [
'text-decoration-none',
'align-bottom',
light ? 'text-dark': 'text-white',
Copy link
Contributor

@drishu drishu Feb 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like this needs to be added also to the title printed in mobile, see
Screenshot 2022-02-23 at 18 58 24

@escuriola escuriola force-pushed the OEL-1160 branch 2 times, most recently from 7748bf0 to 129eec2 Compare February 24, 2022 08:32
drishu
drishu previously approved these changes Feb 24, 2022
*/
function oe_whitelabel_preprocess_page(&$variables) {
if ($variables['bcl_component_library'] === 'ec') {
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Commission');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Commission');
$variables['logo_aria_label'] = t('Home - European Commission');

$site_logo_href = 'https://ec.europa.eu/info';
}
elseif ($variables['bcl_component_library'] === 'eu') {
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Union');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Union');
$variables['logo_aria_label'] = t('Home - European Union');

Comment on lines 28 to 29
{% set img_classes = ['d-none','d-lg-inline-block', 'text-decoration-none', 'site-logo'] %}
<a {{ create_attribute().addClass(img_classes).setAttribute('rel', 'Home') }} href="{{ path('<front>') }}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% set img_classes = ['d-none','d-lg-inline-block', 'text-decoration-none', 'site-logo'] %}
<a {{ create_attribute().addClass(img_classes).setAttribute('rel', 'Home') }} href="{{ path('<front>') }}">
<a class="d-none d-lg ...." href="{{ path('<front>') }}">

Rel attribute I didn't find a value for home https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel

#}
{% set attributes = attributes.addClass('nav') %}
{% if content %}
<ul{{ attributes }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, region content inside a ul tag? This is weird.

Comment on lines 74 to 75
{% set attributes = create_attribute().addClass(['bcl-header', 'bcl-header--' ~ bcl_component_library]) %}
<header {{ attributes }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just output in the header tag.

{% else %}
<div class="container mt-5">
{% endif %}
<div class="container {{ page.header ? 'mt-2': 'mt-5' }} ">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div class="container {{ page.header ? 'mt-2': 'mt-5' }} ">
<div class="container {{ page.header ? 'mt-2': 'mt-5' }}">

$builder = \Drupal::entityTypeManager()->getViewBuilder('block');
$build = $builder->view($entity, 'block');
$render = $this->container->get('renderer')->renderRoot($build);
$crawler = new Crawler($render->__toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$crawler = new Crawler($render->__toString());
$crawler = new Crawler((string) $render);

{#
/**
* @file
* Default theme implementation to display a region.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this. Write which template we are overriding too.

{% if light is not empty %}
{% set project_classes = project_classes ~ ' light' %}
{% endif %}
<div {{ create_attribute().addClass(project_classes) }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div {{ create_attribute().addClass(project_classes) }}>
<div class="bcl-header__project{{ light is not empty ? ' light' }}">

Comment on lines 31 to 36
</a>
{% endif %}
{% if site_name is not empty %}
{% set name_classes = [
'text-decoration-none',
'align-bottom',
'bcl-header__site-name',
'mw-100',
] %}
{% set _site_name %}
<a {{ create_attribute().addClass(name_classes).setAttribute('rel', 'Home') }}
href="{{ path('<front>') }}">
{{ site_name }}
</a>
{% endset %}
{% set _site_name_classes = ['bcl-header__site-name', 'site-name'] %}
{% if bcl_component_library == 'neutral' %}
{% set _site_name_classes = _site_name_classes|merge(['h5', 'd-inline-block', 'd-lg-none']) %}
{% endif %}
<div {{ create_attribute().addClass(_site_name_classes) }}>
{{ _site_name }}
</div>
{% endif %}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't abuse attributes, if you can just output in html.

brummbar
brummbar previously approved these changes Mar 9, 2022
Copy link
Contributor

@brummbar brummbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's rebase and merge.

brummbar
brummbar previously approved these changes Mar 11, 2022
Copy link
Contributor

@brummbar brummbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

Copy link
Contributor

@drishu drishu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add the diff to 1.x in composer

@brummbar brummbar merged commit 50efe5b into 1.x Mar 14, 2022
@brummbar brummbar deleted the OEL-1160 branch March 14, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants