defmodule LivebookWeb.LearnHelpers do use Phoenix.Component use LivebookWeb, :verified_routes @doc """ Renders an learn notebook card. """ attr :notebook_info, :map, required: true def notebook_card(assigns) do ~H""" <.link navigate={~p"/learn/notebooks/#{@notebook_info.slug}"} class="flex flex-col border-2 border-gray-100 hover:border-gray-200 rounded-2xl" >
{"#{@notebook_info.title}
<%= @notebook_info.title %>

<%= @notebook_info.details.description %>

""" end @doc """ Resolves the given image source into a URL. """ @spec learn_img_src(Livebook.Notebook.Learn.image_source()) :: String.t() def learn_img_src({:url, url}), do: url def learn_img_src({:static, filename}), do: ~p"/images/#{filename}" end