From 4a288c32a4bf183a0ef05982fc450473c27e06e2 Mon Sep 17 00:00:00 2001 From: elepedus Date: Sun, 4 Aug 2024 21:03:51 +0100 Subject: [PATCH] Remove `:template` keyword argument from `Kino.Layout.Grid` --- lib/kino/layout.ex | 23 ++++------------------- lib/kino/render.ex | 1 - 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/lib/kino/layout.ex b/lib/kino/layout.ex index 5f700c36..25af4a9e 100644 --- a/lib/kino/layout.ex +++ b/lib/kino/layout.ex @@ -43,7 +43,8 @@ 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` @@ -51,10 +52,6 @@ defmodule Kino.Layout do * `: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 = @@ -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} diff --git a/lib/kino/render.ex b/lib/kino/render.ex index f7a03ba0..cb6ad011 100644 --- a/lib/kino/render.ex +++ b/lib/kino/render.ex @@ -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 }