Skip to content

Commit

Permalink
Remove :template keyword argument from Kino.Layout.Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
elepedus committed Aug 4, 2024
1 parent d69a9b6 commit 4a288c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
23 changes: 4 additions & 19 deletions lib/kino/layout.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@ defmodule Kino.Layout do
## Options
* `:columns` - the number of columns in the grid. Defaults to `1`
* `:columns` - the number of columns in the grid. Optionally, supports a tuple of relative column widths, e.g:
{4,3,8}, for three columns, with the last twice as wide as the first. Defaults to `1`.
* `:boxed` - whether the grid should be wrapped in a bordered box.
Defaults to `false`
* `:gap` - the amount of spacing between grid items in pixels.
Defaults to `8`
* `:template` - the [`grid-template-columns`](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)
style property.
Defaults to `repeat(\#\{assigns.columns\}, minmax(0, 1fr))`
## Examples
images =
Expand All @@ -67,24 +64,12 @@ defmodule Kino.Layout do
"""
@spec grid(list(term()), keyword()) :: t()
def grid(terms, opts \\ []) when is_list(terms) do
opts =
Keyword.validate!(opts,
columns: 1,
boxed: false,
gap: 8,
template:
"repeat(#{if opts[:columns] do
opts[:columns]
else
1
end}}, minmax(0, 1fr))"
)
opts = Keyword.validate!(opts, columns: 1, boxed: false, gap: 8)

info = %{
columns: opts[:columns],
boxed: opts[:boxed],
gap: opts[:gap],
template: opts[:template]
gap: opts[:gap]
}

%Kino.Layout{type: :grid, items: terms, info: info}
Expand Down
1 change: 0 additions & 1 deletion lib/kino/render.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ defimpl Kino.Render, for: Kino.Layout do
type: :grid,
outputs: outputs,
columns: kino.info.columns,
template: kino.info.template,
gap: kino.info.gap,
boxed: kino.info.boxed
}
Expand Down

0 comments on commit 4a288c3

Please sign in to comment.