feat(dsfr): new NoticeComponent
This commit is contained in:
parent
a5e1d8865b
commit
ab82128585
5 changed files with 40 additions and 0 deletions
12
app/components/dsfr/notice_component.rb
Normal file
12
app/components/dsfr/notice_component.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bandeau-d-information-importante/
|
||||
class Dsfr::NoticeComponent < ApplicationComponent
|
||||
renders_one :title
|
||||
|
||||
def initialize(closable: false)
|
||||
@closable = closable
|
||||
end
|
||||
|
||||
def closable?
|
||||
!!@closable
|
||||
end
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
en:
|
||||
close_notice: Hide message
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
fr:
|
||||
close_notice: Masquer le message
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
.fr-notice.fr-notice--info
|
||||
.fr-container
|
||||
.fr-notice__body
|
||||
%p.fr-notice__title
|
||||
= title
|
||||
|
||||
- if closable?
|
||||
%button.fr-btn--close.fr-btn{ title: t('.close_notice'), onclick: 'const notice = this.parentNode.parentNode.parentNode; notice.parentNode.removeChild' }
|
||||
= t('.close_notice')
|
Loading…
Add table
Add a link
Reference in a new issue