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

22 lines
518 B
Ruby
Raw Normal View History

# 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
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