mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-16 04:46:46 +08:00
285bc923b7
Co-authored-by: José Valim <jose.valim@gmail.com>
32 lines
1 KiB
Elixir
32 lines
1 KiB
Elixir
defmodule LivebookWeb.LearnHelpers do
|
|
use Phoenix.Component
|
|
|
|
alias LivebookWeb.Router.Helpers, as: Routes
|
|
|
|
@doc """
|
|
Renders an learn notebook card.
|
|
"""
|
|
def notebook_card(assigns) do
|
|
~H"""
|
|
<div class="flex flex-col">
|
|
<%= live_redirect to: Routes.learn_path(@socket, :notebook, @notebook_info.slug),
|
|
class: "flex items-center justify-center p-6 border-2 border-gray-100 rounded-t-2xl h-[150px]" do %>
|
|
<img
|
|
src={@notebook_info.details.cover_url}
|
|
class="max-h-full max-w-[75%]"
|
|
alt={"#{@notebook_info.title} logo"}
|
|
/>
|
|
<% end %>
|
|
<div class="px-6 py-4 bg-gray-100 rounded-b-2xl grow">
|
|
<%= live_redirect(@notebook_info.title,
|
|
to: Routes.learn_path(@socket, :notebook, @notebook_info.slug),
|
|
class: "text-gray-800 font-semibold cursor-pointer"
|
|
) %>
|
|
<p class="mt-2 text-sm text-gray-600">
|
|
<%= @notebook_info.details.description %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
"""
|
|
end
|
|
end
|