Skip to content

Commit

Permalink
chore: one more table exampe
Browse files Browse the repository at this point in the history
  • Loading branch information
phgrey committed Dec 13, 2023
1 parent eb5f86b commit 6356fad
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/moon/design/dropdown/option_with_icon.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule Moon.Design.Dropdown.IconOption do
@doc "Additional values to be passed"
prop(values, :map, from_context: :values)

@doc "Inner content of the option"
@doc "Inner content of the option, unused"
slot(default)

def render(assigns) do
Expand Down
30 changes: 30 additions & 0 deletions lib/moon_web/examples/light/table_example/editable.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
defmodule MoonWeb.Examples.Light.TableExample.Editable do
@moduledoc false
use Moon.Light.LiveComponent
use MoonWeb, :example

import Elixir.Moon.Light.Table

attr(:models, :list,
default:
Enum.map(1..5, fn x ->
%{id: x, name: "Name #{x}", created_at: DateTime.add(DateTime.utc_now(), -3600 + x)}
end)
)

def render(assigns) do
~H"""
<.table items={@models} selected={nil}>
<:cols :let={model} name="id" label="ID">
<.input value={model.id} />
</:cols>
<:cols :let={model} name="name" label="First Name">
<.input value={model.name} />
</:cols>
<:cols :let={model} name="created_at" label="Created at">
<.input value={Timex.format!(model.created_at, "%b %d, %Y, %H:%M:%S", :strftime)} />
</:cols>
</.table>
"""
end
end

0 comments on commit 6356fad

Please sign in to comment.