ash_hq/lib/ash_hq_web/components/docs/doc_path.ex

35 lines
1,013 B
Elixir
Raw Normal View History

2022-09-13 11:36:28 +12:00
defmodule AshHqWeb.Components.Docs.DocPath do
@moduledoc "Renders breadcrumbs to the path of the doc currently being viewed"
2022-09-13 11:36:28 +12:00
use Surface.Component
alias AshHqWeb.Components.CalloutText
prop doc_path, :list, required: true
def render(assigns) do
~F"""
<div class="flex flex-row space-x-1 items-center overflow-hidden">
{#case @doc_path}
{#match [item]}
<div class="dark:text-white">
2022-09-13 11:36:28 +12:00
{item}
</div>
{#match path}
{#for item <- :lists.droplast(path)}
<span class="text-base-light-400">
{item}
</span>
<Heroicons.Outline.ChevronRightIcon class="w-3 h-3" />
{/for}
<span class="dark:text-white overflow-hidden" phx-hook="TextOverflow" id="doc-path">
2023-02-07 17:34:59 +13:00
<CalloutText
text={List.last(path)}
class="overflow-hidden block text-ellipsis whitespace-nowrap"
/>
2022-09-13 11:36:28 +12:00
</span>
{/case}
2022-09-13 11:36:28 +12:00
</div>
"""
end
end