34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/primer/view_components/linters/argument_mappers/button.rb', line 34
def attribute_to_args(attribute)
attr_name = attribute.name
case attr_name
when "disabled"
{ disabled: true }
when "type"
return {} if attribute.value == "button"
raise ConversionError, "Button component does not support type \"#{attribute.value}\"" unless TYPE_OPTIONS.include?(attribute.value)
{ type: ":#{attribute.value}" }
else
{ attr_name.to_sym => erb_helper.convert(attribute) }
end
end
|