mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 19:21:36 +02:00
18 lines
399 B
Ruby
18 lines
399 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ReactComponentHelper
|
|
def react_component(name, props = {}, &block)
|
|
data = { component: name.to_s.camelcase, props: }
|
|
if block_given?
|
|
tag.div data:, &block
|
|
else
|
|
tag.div nil, data:
|
|
end
|
|
end
|
|
|
|
def react_admin_component(name, props = {})
|
|
data = { 'admin-component': name.to_s.camelcase, props: }
|
|
tag.div nil, data:
|
|
end
|
|
end
|