add heading level customization to callout component to fix a11y issue
This commit is contained in:
parent
bc3e67ab94
commit
b0df654346
3 changed files with 6 additions and 4 deletions
|
@ -4,13 +4,14 @@ class Dsfr::CalloutComponent < ApplicationComponent
|
|||
renders_one :html_body
|
||||
renders_one :bottom
|
||||
|
||||
attr_reader :title, :theme, :icon, :extra_class_names
|
||||
attr_reader :title, :theme, :icon, :extra_class_names, :heading_level
|
||||
|
||||
def initialize(title:, theme: :info, icon: nil, extra_class_names: nil)
|
||||
def initialize(title:, theme: :info, icon: nil, extra_class_names: nil, heading_level: 'h3')
|
||||
@title = title
|
||||
@theme = theme
|
||||
@icon = icon
|
||||
@extra_class_names = extra_class_names
|
||||
@heading_level = heading_level
|
||||
end
|
||||
|
||||
def callout_class
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
%div{ class: callout_class }
|
||||
- if title.present?
|
||||
%h3.fr-callout__title= title
|
||||
= content_tag(heading_level, class: 'fr-callout__title') do
|
||||
= title
|
||||
- if html_body?
|
||||
.fr-callout__text= html_body
|
||||
- if body?
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
%h1.page-title.fr-h2= t('views.users.dossiers.index.dossiers')
|
||||
|
||||
- if @last_dossier_editable.present?
|
||||
= render Dsfr::CalloutComponent.new(title: t('users.dossiers.header.callout.last_dossier_editable_title')) do |c|
|
||||
= render Dsfr::CalloutComponent.new(title: t('users.dossiers.header.callout.last_dossier_editable_title'), heading_level: 'h2') do |c|
|
||||
- c.with_body do
|
||||
%p
|
||||
= t('users.dossiers.header.callout.last_dossier_editable_text', time_ago: time_ago_in_words(@last_dossier_editable.created_at), libelle: @last_dossier_editable.procedure.libelle )
|
||||
|
|
Loading…
Reference in a new issue