diff --git a/lib/doggo.ex b/lib/doggo.ex index 38adbe9..b0348dd 100644 --- a/lib/doggo.ex +++ b/lib/doggo.ex @@ -81,6 +81,62 @@ defmodule Doggo do defp maybe_clear_flash(false, _), do: %JS{} + @doc """ + Renders a card in an `article` tag, typically used repetitively in a grid or + flex box layout. + + ## Usage + + + <:image> + Picture of a dog dressed in a poncho. + + <:header>

Dog Fashion Show

+ <:main> + The next dog fashion show is coming up quickly. Here's what you need + to look out for. + + <:footer> + 2023-11-15 12:24 + Events + +
+ """ + + attr :class, :string, default: nil, doc: "Additional CSS classes." + attr :rest, :global, doc: "Any additional HTML attributes." + + slot :image, + doc: """ + An optional image slot. The slot content will be rendered within a figure + element. + """ + + slot :header, + doc: """ + The header of the card. You typically want to wrap the header in a `h2` or + `h3` tag, or another header level, depending on the hierarchy on the page. + """ + + slot :main, doc: "The main content of the card." + + slot :footer, + doc: """ + A footer of the card, typically containing controls, tags, or meta + information. + """ + + def card(assigns) do + ~H""" +
+
<%= render_slot(@image) %>
+
<%= render_slot(@header) %>
+
<%= render_slot(@main) %>
+ +
+ """ + end + @doc """ Renders a customizable icon using a slot for SVG content.