style(dsfr/callout): more theming for callout component
This commit is contained in:
parent
c4f6305b3a
commit
46b69da396
3 changed files with 39 additions and 4 deletions
|
@ -2,11 +2,28 @@
|
|||
class Dsfr::CalloutComponent < ApplicationComponent
|
||||
renders_one :body
|
||||
|
||||
private
|
||||
attr_reader :title, :theme, :icon
|
||||
|
||||
def initialize(title:)
|
||||
def initialize(title:, theme: :info, icon: nil)
|
||||
@title = title
|
||||
@theme = theme
|
||||
@icon = icon
|
||||
end
|
||||
|
||||
attr_reader :title
|
||||
def callout_class
|
||||
["fr-callout", theme_class, icon]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def theme_class
|
||||
case theme
|
||||
when :warning
|
||||
"fr-callout--brown-caramel"
|
||||
when :success
|
||||
"fr-callout--green-emeraude"
|
||||
else
|
||||
# info is default theme
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
%div.fr-callout
|
||||
%div{ class: callout_class }
|
||||
%h3.fr-callout__title= title
|
||||
%p.fr-callout__text= body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue