- Issue created by @pdureau
- Assigned to smustgrave
- First commit to issue fork.
- πΊπΈUnited States smustgrave
Can you mention what shouldn't belong? Would renaming site-branding make more sense for what's being done?
- π«π·France pdureau Paris
On the component template, I would keep only the logo stuff as understood from https://designsystem.digital.gov/components/header/ :
- Slots: image
- Props: path (url), text (string)
Non tested code, just a quick and humble proposal:
<div{{ attributes.addClass(['usa-logo']) }}> <em class="usa-logo__text"> {% if path %} <a class="logo-img" href="{{ path }}" accesskey="1" title="{{ text }}" aria-label="Home"> {% endif %} {{ image|default(text) }} {% if path %} </a> {% endif %} </div>
{% if site_logo %}
{{ pattern('logo', {
'path': path(''),
'text': site_name,
'image': site_logo
}) }}
{% endif %}Then on block--system-branding-block.html.twig (Non tested code):
{% if site_logo %} {{ pattern('logo', { 'path': path('<front>'), 'text': site_name, 'image': site_logo }) }} {% endif %} {% if site_name %} <a href="{{ path('<front>') }}" accesskey="2" title="{{ 'Home'|t }}" aria-label="Home"> {{ site_name }} </a> {% endif %} {% if site_slogan %} <h2 class="usa-font-lead">{{ site_slogan }}</h2> {% endif %} <button class="usa-menu-btn" type="button">{{ 'Menu'|t }}</button>
- Status changed to Needs review
about 1 year ago 5:58pm 12 February 2024 - Status changed to Needs work
about 1 year ago 7:59pm 20 February 2024 - πΊπΈUnited States smustgrave
<div class="usa-logo site-logo" id="logo"> <em class="usa-logo__text">
So not sure what's to be done. Everything with the logo is wrapped in this. So to add the other stuff back I think I would end up with what it is now.
- Status changed to Needs review
about 1 year ago 1:35pm 21 February 2024 - π«π·France pdureau Paris
If there is a class starting with "usa-logo", it belongs to the component.
Stuff without a class starting with "usa-logo":
- belongs to the site branding template if outside "usa-logo"
- is the content of a slot if inside "usa-logo"
My proposal from https://www.drupal.org/project/ui_suite_uswds/issues/3417850#comment-154... π Logo component do too much Needs review was not OK?
- πΊπΈUnited States smustgrave
Right but the div and em tags with those classes wrap around
{% if site_slogan %}
{{ site_slogan }}
{% endif %}
{{ 'Menu'|t }} - Status changed to Postponed: needs info
about 1 year ago 9:40pm 24 February 2024 - πΊπΈUnited States smustgrave
So the suggestion doesn't close the em and div tags. But even adding that the slogan and menu button are now outside those tags when they need to be inside those tags.
- Status changed to Needs work
about 1 year ago 12:56am 5 April 2024 - πΊπΈUnited States smustgrave
While working on a project do believe this can be redone but not sure how much simplier it will be.
-
smustgrave β
committed e2292aec on 3.0.x
Issue #3417850: Logo component do too much
-
smustgrave β
committed e2292aec on 3.0.x
- Status changed to Fixed
about 1 year ago 2:40pm 5 April 2024 - πΊπΈUnited States smustgrave
Simplified the logo some and actually addressed some accessibility issues
Felt bad putting display-flex flex-align-center flex-no-wrap but Drupal logo is different then uswds as we have a site name and in some scenarios a slogna.
the alt text for the image will be empty if the site name is present as a screenreader would read the alt text + site name and probably won't make sense
- Status changed to Needs work
about 1 year ago 1:12am 9 April 2024 - πΊπΈUnited States smustgrave
Going to re-open as I think there's a different approach I want to take to make it reusable by the footer also.
-
smustgrave β
committed 64c8b19a on 3.0.x
Issue #3417850 by smustgrave, pdureau: Logo component do too much
-
smustgrave β
committed 64c8b19a on 3.0.x
- Status changed to Fixed
about 1 year ago 7:14pm 9 April 2024 - πΊπΈUnited States smustgrave
So was able to reduce the logo component down to just using a content slot. So in the block I set that variable and pass in what I need.
This allows for a little more control and overriding the block-system-branding block to make changes vs needing to override the logo pattern.
Automatically closed - issue fixed for 2 weeks with no activity.