Class: Panda::Core::Admin::CodeBlockComponent

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

Overview

Code block component for snippets and examples.

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code: nil, **attrs) ⇒ CodeBlockComponent

Returns a new instance of CodeBlockComponent.



8
9
10
11
# File 'app/components/panda/core/admin/code_block_component.rb', line 8

def initialize(code: nil, **attrs)
  @code = code
  super(**attrs)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



13
14
15
# File 'app/components/panda/core/admin/code_block_component.rb', line 13

def code
  @code
end

Instance Method Details

#default_attrsObject



15
16
17
18
19
# File 'app/components/panda/core/admin/code_block_component.rb', line 15

def default_attrs
  {
    class: "rounded-xl bg-gray-900/95 p-3 text-xs text-emerald-200 font-mono overflow-x-auto"
  }
end