defmodule ScalesCmsWeb.Components.CmsComponentsRenderer do @moduledoc """ The renderer of all the blocks, linking them to the right components """ use ScalesCmsWeb, :live_component attr :id, :string, required: true attr :published, :boolean, required: true attr :block, ScalesCms.Cms.CmsPageVariantBlock def render_preview(assigns) do assigns = assign( assigns, :component, ScalesCmsWeb.Components.CmsComponents.get_component(assigns.block.component_type) ) ~H"""
<%= if @component do %> {@component.render_preview(assigns)} <% else %>

ID: {@block.id}

Type: {@block.component_type}

Sort order: {@block.sort_order}

<% end %>
""" end end