[beta6] Add missing notice component

Created on 21 March 2024, 9 months ago
Updated 11 April 2024, 8 months ago

Problem/Motivation

Notice component was introduced by DSFR 1.10 and need to be added in the theme

Proposed resolution

add the component

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @YannDecelle
  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • Status changed to Needs work 9 months ago
  • 🇫🇷France pdureau Paris

    so, you decided to keep 3 options in

        dismissible:
          type: select
          label: Dismissible?
          description: It’s possible to dismiss any notice inline.
          options:
            "": No
            core: Using dsfr
            custom: Custom

    And use only one in the Twig:

    <button{% if dismissible == 'core' %} onclick="const notice = this.parentNode; notice.parentNode.removeChild(notice);" {% endif %} class="fr-btn fr-btn--close" title="{{ close_title }}">{{ close_title }}</button>

    It doesn't look right...

  • 🇫🇷France pdureau Paris

    I may have understood why it is also like that in alert component:

    • if dismissible is false: no button.
    • if dismissible == "custom" : a button, without the event, so the sub-theme need to provide its own event.
    • if dismissible == "core" : a button, with the onclick event from DSFR.

    So, the twig snippet make sense:

      {% if dismissible %}
        {% set close_title = close_title|default('Close'|t) %}
        <button{% if dismissible == 'core' %} onclick="const alert = this.parentNode; alert.parentNode.removeChild(alert);"{% endif %} class="fr-btn fr-btn--close" title="{{ close_title }}">{{ close_title }}</button>
      {% endif %}
    

    Maybe there is something to do in both alert and notice component to make this clearer:

    Do we rename the options label?
    And/or do we revamp a bit the Twig implementation?
    And/or do we move some logic to button component?

    I would be glad to have a talk before any implementation.

    Moved to beta6 in case a breaking change is done to alert. Let's add ⚠️ to the ticket title if we do the change.

  • 🇫🇷France pdureau Paris

    Also, closing the notice keep the component wrapper. Let's fix that.

  • Status changed to Fixed 9 months ago
  • 🇫🇷France pdureau Paris

    Checked with Yassine.

    Do we rename the options label?

    We moved to boolean prop

    And/or do we revamp a bit the Twig implementation?

    Indeed, because of boolean prop

    And/or do we move some logic to button component?

    No, because we noticed than the onlcik event is different from alert to notice.

    Do we change also alert component?

    No, too risky.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024