From ff5a3ff09e68f7ae3b4ea6b3cd8c8bbf5ab37442 Mon Sep 17 00:00:00 2001 From: nhobes Date: Wed, 2 Oct 2024 13:12:09 +1000 Subject: [PATCH] v2.1.0 --- CHANGELOG.md | 4 ++++ assets/default.css | 7 +++++-- lib/petal_components/table.ex | 3 ++- mix.exs | 2 +- test/petal/table_test.exs | 14 +++++++++++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9370bb8b..284991f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +### 2.1.0 - 2024-10-02 03:12:09 + +- Adds new ghost table variant for extremely clean look + ### 2.0.6 - 2024-09-26 04:23:16 - Items center correctly for the Icon Button by @mitkins in https://github.com/petalframework/petal_components/pull/352 diff --git a/assets/default.css b/assets/default.css index ce3488a7..baf2bbea 100644 --- a/assets/default.css +++ b/assets/default.css @@ -211,7 +211,7 @@ } .pc-icon-button__inner { - @apply flex flex-col items-center + @apply flex flex-col items-center } .pc-icon-button__inner--tooltip { @@ -1001,9 +1001,12 @@ /* Table */ -.pc-table { +.pc-table--surface { @apply min-w-full overflow-hidden rounded-sm shadow table-auto ring-1 ring-gray-200 dark:ring-gray-800 sm:rounded; } +.pc-table--ghost { + @apply min-w-full overflow-hidden table-auto; +} .pc-table__th { @apply px-6 py-3 text-sm font-semibold tracking-wider text-left text-gray-900 bg-gray-50 dark:bg-gray-800 dark:text-gray-300; } diff --git a/lib/petal_components/table.ex b/lib/petal_components/table.ex index 2d15ede0..85bce785 100644 --- a/lib/petal_components/table.ex +++ b/lib/petal_components/table.ex @@ -16,6 +16,7 @@ defmodule PetalComponents.Table do """ attr :id, :string attr :class, :any, default: nil, doc: "CSS class" + attr :variant, :string, default: "surface", values: ["ghost", "surface"] attr :rows, :list, default: [], doc: "the list of rows to render" attr :row_id, :any, default: nil, doc: "the function for generating the row id" attr :row_click, :any, default: nil, doc: "the function for handling phx-click on each row" @@ -46,7 +47,7 @@ defmodule PetalComponents.Table do assigns = assign_new(assigns, :id, fn -> "table_#{Ecto.UUID.generate()}" end) ~H""" - +
<%= if length(@col) > 0 do %> <.tr> diff --git a/mix.exs b/mix.exs index fee15679..e35329a6 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule PetalComponents.MixProject do use Mix.Project @source_url "https://github.com/petalframework/petal_components" - @version "2.0.6" + @version "2.1.0" def project do [ diff --git a/test/petal/table_test.exs b/test/petal/table_test.exs index 76e0316f..67c75d2e 100644 --- a/test/petal/table_test.exs +++ b/test/petal/table_test.exs @@ -81,7 +81,19 @@ defmodule PetalComponents.TableTest do """) assert html =~ " + """) + + assert html =~ "