defmodule MoonWeb.Examples.Design.TableExample.Responsive do @moduledoc """ Responsive design for the table. To see what it's about - just resize the window, or press to open the console and resize it sizes can be ssen here - https://tailwindcss.com/docs/screens """ use Moon.StatelessComponent use MoonWeb, :example alias Moon.Design.Table import MoonWeb.Helpers.Lorem prop(models, :list, default: Enum.map(1..5, fn x -> %{ id: x, name: "Name #{x}", created_at: DateTime.utc_now(), user: "User ##{x}", lorem: "lorem ipsum dolor sit almet", long_text: lorem() } end) ) def render(assigns) do ~F"""
{model.id} {model.name}

{Timex.format!(model.created_at, "%b %d, %Y", :strftime)}

{model.user} {model.lorem}

{model.long_text |> String.slice(0, 70)}...

#{model.id}: {model.name} by {model.user} at {Timex.format!(model.created_at, "%b %d, %Y", :strftime)}
{model.long_text |> String.slice(0, 30)}...
""" end def code() do """ alias Moon.Design.Table import MoonWeb.Helpers.Lorem prop(models, :list, default: Enum.map(1..5, fn x -> %{ id: x, name: "Name \#{x}", created_at: DateTime.utc_now(), user: "User #\#{x}", lorem: "lorem ipsum dolor sit almet", long_text: lorem() } end) ) def render(assigns) do ~F\""" {model.id} {model.name}

{Timex.format!(model.created_at, "%b %d, %Y", :strftime)}

{model.user} {model.lorem}

{model.long_text |> String.slice(0, 70)}...

\#{model.id}: {model.name} by {model.user} at {Timex.format!(model.created_at, "%b %d, %Y", :strftime)}
{model.long_text |> String.slice(0, 30)}...
\""" end """ end end