mirror of
https://github.com/System-End/identity-vault.git
synced 2026-04-19 16:28:21 +00:00
24 lines
633 B
Ruby
24 lines
633 B
Ruby
class Components::APIExample < Components::Base
|
|
extend Literal::Properties
|
|
prop :method, _Nilable(String)
|
|
prop :url, _Nilable(String)
|
|
prop :path_only, _Boolean?
|
|
|
|
def view_template
|
|
div style: { margin: "10px 0" } do
|
|
code style: { background: "black", padding: "0.2em", color: "white" } do
|
|
span style: { color: "cyan" } do
|
|
@method
|
|
end
|
|
plain " "
|
|
copy_to_clipboard @url do
|
|
if @path_only
|
|
CGI.unescape(URI.parse(@url).tap { |u| u.host = u.scheme = u.port = nil }.to_s)
|
|
else
|
|
@url
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|