Class: InspectorPanel::Component
- Inherits:
-
Lookbook::BaseComponent
- Object
- Lookbook::BaseComponent
- InspectorPanel::Component
- Defined in:
- app/components/lookbook/inspector_panel/component.rb
Instance Attribute Summary collapse
-
#panel_html ⇒ Object
readonly
Returns the value of attribute panel_html.
-
#panel_styles ⇒ Object
readonly
Returns the value of attribute panel_styles.
Instance Method Summary collapse
- #before_render ⇒ Object
- #id ⇒ Object
-
#initialize(name:, **attrs) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(name:, **attrs) ⇒ Component
Returns a new instance of Component.
5 6 7 8 |
# File 'app/components/lookbook/inspector_panel/component.rb', line 5 def initialize(name:, **attrs) @name = name super(**attrs) end |
Instance Attribute Details
#panel_html ⇒ Object (readonly)
Returns the value of attribute panel_html.
3 4 5 |
# File 'app/components/lookbook/inspector_panel/component.rb', line 3 def panel_html @panel_html end |
#panel_styles ⇒ Object (readonly)
Returns the value of attribute panel_styles.
3 4 5 |
# File 'app/components/lookbook/inspector_panel/component.rb', line 3 def panel_styles @panel_styles end |
Instance Method Details
#before_render ⇒ Object
14 15 16 17 18 |
# File 'app/components/lookbook/inspector_panel/component.rb', line 14 def before_render styles, html = StylesExtractor.call(content) @panel_styles = styles.map { |s| "##{id} #{s}" }.join("\n") @panel_html = html.html_safe end |