ash_hq/lib/ash_hq_web/components/docs/source_link.ex
2022-11-16 14:36:05 -05:00

17 lines
489 B
Elixir

defmodule AshHqWeb.Components.Docs.SourceLink do
@moduledoc "A link to the source code of a given module or function"
use Surface.Component
import AshHqWeb.Helpers
prop module_or_function, :any, required: true
prop library, :any, required: true
prop library_version, :any, required: true
def render(assigns) do
~F"""
{#if @module_or_function.file}
<a href={source_link(@module_or_function, @library, @library_version)}>{"</>"}</a>
{/if}
"""
end
end