Class: Emjay::Components::MjWrapper

Inherits:
MjSection show all
Defined in:
lib/emjay/components/body/mj_wrapper.rb

Instance Attribute Summary

Attributes inherited from Emjay::Component

#attributes, #context, #props

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MjSection

default_attributes, #get_styles, #render

Methods inherited from BodyComponent

#get_box_widths, #get_shorthand_attr_value, #get_shorthand_border_value, #get_styles, #html_attributes, #render_children, #styles

Methods inherited from Emjay::Component

default_attributes, ending_tag?, #get_attribute, #get_content, #initialize, raw_element?

Constructor Details

This class inherits a constructor from Emjay::Component

Class Method Details

.allowed_attributesObject



12
13
14
# File 'lib/emjay/components/body/mj_wrapper.rb', line 12

def self.allowed_attributes
  MjSection.allowed_attributes.merge("gap" => "unit(px)")
end

.component_nameObject



8
9
10
# File 'lib/emjay/components/body/mj_wrapper.rb', line 8

def self.component_name
  "mj-wrapper"
end

Instance Method Details

#get_child_contextObject



16
17
18
19
20
21
22
# File 'lib/emjay/components/body/mj_wrapper.rb', line 16

def get_child_context
  widths = get_box_widths
  @context.merge(
    container_width: "#{widths[:box]}px",
    gap: get_attribute("gap")
  )
end