defmodule LivebookWeb.NotebookComponents do use LivebookWeb, :html @doc """ Renders an learn notebook card. """ attr :notebook_info, :map, required: true def learn_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}" @doc """ Renders an icon for the given cell. """ attr :cell_type, :atom, required: true attr :language, :atom, default: nil def cell_icon(assigns) def cell_icon(%{cell_type: :code, language: :elixir} = assigns) do ~H"""
""" end def cell_icon(%{cell_type: :code, language: :erlang} = assigns) do ~H"""
""" end def cell_icon(%{cell_type: :markdown} = assigns) do ~H"""
""" end def cell_icon(%{cell_type: :smart} = assigns) do ~H"""
<.remix_icon icon="flashlight-line text-red-900" />
""" end end