2022-09-21 18:06:22 +08:00
|
|
|
defmodule LivebookWeb.LearnHelpers do
|
2021-07-07 20:32:49 +08:00
|
|
|
use Phoenix.Component
|
2021-06-03 03:51:43 +08:00
|
|
|
|
2021-07-07 20:32:49 +08:00
|
|
|
alias LivebookWeb.Router.Helpers, as: Routes
|
|
|
|
|
|
|
|
@doc """
|
2022-09-21 18:06:22 +08:00
|
|
|
Renders an learn notebook card.
|
2021-07-07 20:32:49 +08:00
|
|
|
"""
|
|
|
|
def notebook_card(assigns) do
|
|
|
|
~H"""
|
2022-10-25 21:33:15 +08:00
|
|
|
<%= live_redirect to: Routes.learn_path(@socket, :notebook, @notebook_info.slug),
|
|
|
|
class: "flex flex-col border-2 border-gray-100 hover:border-gray-200 rounded-2xl" do %>
|
|
|
|
<div class="flex items-center justify-center p-6 border-b-2 border-gray-100 rounded-t-2xl h-[150px]">
|
2022-08-02 21:51:02 +08:00
|
|
|
<img
|
|
|
|
src={@notebook_info.details.cover_url}
|
|
|
|
class="max-h-full max-w-[75%]"
|
|
|
|
alt={"#{@notebook_info.title} logo"}
|
|
|
|
/>
|
2022-10-25 21:33:15 +08:00
|
|
|
</div>
|
2021-12-30 05:06:19 +08:00
|
|
|
<div class="px-6 py-4 bg-gray-100 rounded-b-2xl grow">
|
2022-10-25 21:33:15 +08:00
|
|
|
<span class="text-gray-800 font-semibold"><%= @notebook_info.title %></span>
|
2021-06-03 03:51:43 +08:00
|
|
|
<p class="mt-2 text-sm text-gray-600">
|
2021-11-03 05:32:58 +08:00
|
|
|
<%= @notebook_info.details.description %>
|
2021-06-03 03:51:43 +08:00
|
|
|
</p>
|
|
|
|
</div>
|
2022-10-25 21:33:15 +08:00
|
|
|
<% end %>
|
2021-06-03 03:51:43 +08:00
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|