Class: Emjay::Components::MjAccordionText
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
#get_attribute, #get_child_context, #get_content, #initialize, raw_element?
Class Method Details
.allowed_attributes ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 25
def self.allowed_attributes
{
"background-color" => "color",
"font-size" => "unit(px)",
"font-family" => "string",
"font-weight" => "string",
"letter-spacing" => "unitWithNegative(px,em)",
"line-height" => "unit(px,%,)",
"color" => "color",
"padding-bottom" => "unit(px,%)",
"padding-left" => "unit(px,%)",
"padding-right" => "unit(px,%)",
"padding-top" => "unit(px,%)",
"padding" => "unit(px,%){1,4}"
}
end
|
.component_name ⇒ Object
9
10
11
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 9
def self.component_name
"mj-accordion-text"
end
|
.default_attributes ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 17
def self.default_attributes
{
"font-size" => "13px",
"line-height" => "1",
"padding" => "16px"
}
end
|
.ending_tag? ⇒ Boolean
13
14
15
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 13
def self.ending_tag?
true
end
|
Instance Method Details
#get_styles ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 42
def get_styles
{
td: {
"background" => get_attribute("background-color"),
"font-size" => get_attribute("font-size"),
"font-family" => resolve_font_family,
"font-weight" => get_attribute("font-weight"),
"letter-spacing" => get_attribute("letter-spacing"),
"line-height" => get_attribute("line-height"),
"color" => get_attribute("color"),
"padding" => get_attribute("padding"),
"padding-bottom" => get_attribute("padding-bottom"),
"padding-left" => get_attribute("padding-left"),
"padding-right" => get_attribute("padding-right"),
"padding-top" => get_attribute("padding-top")
},
table: {
"width" => "100%",
"border-bottom" => get_attribute("border")
}
}
end
|
#render ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/emjay/components/body/mj_accordion_text.rb', line 65
def render
content_attrs = html_attributes(class: "mj-accordion-content")
table_attrs = html_attributes(
cellspacing: "0",
cellpadding: "0",
style: :table
)
<<~HTML
<div
#{content_attrs}
>
<table
#{table_attrs}
>
<tbody>
<tr>
#{render_content}
</tr>
</tbody>
</table>
</div>
HTML
end
|