demarches-normaliennes/app/components/dsfr/notice_component.rb
2024-08-22 09:26:48 +02:00

21 lines
518 B
Ruby

# frozen_string_literal: true
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bandeau-d-information-importante/
class Dsfr::NoticeComponent < ApplicationComponent
renders_one :title
attr_reader :data_attributes
def initialize(closable: false, data_attributes: {})
@closable = closable
@data_attributes = data_attributes
end
def closable?
!!@closable
end
def notice_data_attributes
{ "data-dsfr-header-target": "notice" }.merge(data_attributes)
end
end