2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-09-14 15:32:56 +02:00
|
|
|
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bandeau-d-information-importante/
|
|
|
|
class Dsfr::NoticeComponent < ApplicationComponent
|
|
|
|
renders_one :title
|
|
|
|
|
2024-03-18 19:31:57 +01:00
|
|
|
attr_reader :data_attributes
|
|
|
|
|
|
|
|
def initialize(closable: false, data_attributes: {})
|
2022-09-14 15:32:56 +02:00
|
|
|
@closable = closable
|
2024-03-18 19:31:57 +01:00
|
|
|
@data_attributes = data_attributes
|
2022-09-14 15:32:56 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def closable?
|
|
|
|
!!@closable
|
|
|
|
end
|
2024-03-18 19:31:57 +01:00
|
|
|
|
|
|
|
def notice_data_attributes
|
|
|
|
{ "data-dsfr-header-target": "notice" }.merge(data_attributes)
|
|
|
|
end
|
2022-09-14 15:32:56 +02:00
|
|
|
end
|