demarches-normaliennes/app/components/dsfr/notice_component.rb

20 lines
487 B
Ruby
Raw Normal View History

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
attr_reader :data_attributes
def initialize(closable: false, data_attributes: {})
2022-09-14 15:32:56 +02:00
@closable = closable
@data_attributes = data_attributes
2022-09-14 15:32:56 +02:00
end
def closable?
!!@closable
end
def notice_data_attributes
{ "data-dsfr-header-target": "notice" }.merge(data_attributes)
end
2022-09-14 15:32:56 +02:00
end