Class: Emjay::Components::MjSpacer
Instance Attribute Summary
#attributes, #context, #props
Class Method Summary
collapse
Instance Method Summary
collapse
#get_box_widths, #get_child_context, #get_shorthand_attr_value, #get_shorthand_border_value, #html_attributes, #render_children, #styles
ending_tag?, #get_attribute, #get_child_context, #get_content, #initialize, raw_element?
Class Method Details
.allowed_attributes ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/emjay/components/body/mj_spacer.rb', line 19
def self.allowed_attributes
{
"border" => "string",
"border-bottom" => "string",
"border-left" => "string",
"border-right" => "string",
"border-top" => "string",
"container-background-color" => "color",
"padding-bottom" => "unit(px,%)",
"padding-left" => "unit(px,%)",
"padding-right" => "unit(px,%)",
"padding-top" => "unit(px,%)",
"padding" => "unit(px,%){1,4}",
"height" => "unit(px,%)"
}
end
|
.component_name ⇒ Object
9
10
11
|
# File 'lib/emjay/components/body/mj_spacer.rb', line 9
def self.component_name
"mj-spacer"
end
|
.default_attributes ⇒ Object
13
14
15
16
17
|
# File 'lib/emjay/components/body/mj_spacer.rb', line 13
def self.default_attributes
{
"height" => "20px"
}
end
|
Instance Method Details
#get_styles ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/emjay/components/body/mj_spacer.rb', line 36
def get_styles
{
div: {
"height" => get_attribute("height"),
"line-height" => get_attribute("height")
}
}
end
|
#render ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/emjay/components/body/mj_spacer.rb', line 45
def render
div_attrs = html_attributes(style: :div)
<<~HTML
<div
#{div_attrs}
> </div>
HTML
end
|