Class: Panda::Core::Admin::FormErrorComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/form_error_component.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Method Summary collapse

Methods inherited from Base

#after_template, #attrs, #before_template, #merge_attrs, #tailwind_merge_attrs

Instance Method Details

#default_attrsObject



22
23
24
25
26
# File 'app/components/panda/core/admin/form_error_component.rb', line 22

def default_attrs
  {
    class: "mb-4 p-4 bg-red-50 border border-red-200 rounded-md"
  }
end

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/components/panda/core/admin/form_error_component.rb', line 10

def view_template
  return unless should_render?

  div(**@attrs) do
    div(class: "text-sm text-red-600") do
      error_messages.each do |message|
        p { message }
      end
    end
  end
end