defmodule Satsuma.List do use Phoenix.Component import Satsuma.Util attr(:height, :string) attr(:separator, :boolean, default: false) slot(:inner_block, required: true) def list(assigns) do style = styles(%{ "max-height: #{Map.get(assigns, :height, "0")}" => Map.get(assigns, :height, nil) != nil }) classes = class_names(%{ "satsuma_list--separator": assigns.separator }) assigns = assign(assigns, style: style, classes: classes) ~H""" """ end attr(:link, :string, default: nil, doc: "The URI that this list item should go to when clicked") slot(:actions) slot(:inner_block, required: true) def list_item(assigns) do ~H"""
  • <%= render_slot(@inner_block) %>
    <%= render_slot(@inner_block) %>
    <%= render_slot(@actions) %>
  • """ end end