Skip to content

Commit

Permalink
v1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mplatts committed May 26, 2023
1 parent 611759a commit bf79eb4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
### 1.2.6 - 2023-05-26 01:45:26

- Fix radio-group checked options for <.field>
- Fix select selected options

### 1.2.5 - 2023-05-20 00:34:56

- Fix: <.field type="textarea" rows="1"> - rows for textarea are now overridable
Expand Down
6 changes: 3 additions & 3 deletions lib/petal_components/badge.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ defmodule PetalComponents.Badge do
defp get_color_classes(%{color: color, variant: variant}) do
case variant do
"light" ->
"pc-badge--"<>color<>"-light"
"pc-badge--" <> color <> "-light"

"dark" ->
"pc-badge--"<>color<>"-dark"
"pc-badge--" <> color <> "-dark"

"outline" ->
"pc-badge--"<>color<>"-outline"
"pc-badge--" <> color <> "-outline"
end
end
end
3 changes: 1 addition & 2 deletions lib/petal_components/field.ex
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ defmodule PetalComponents.Field do
end

def field(%{type: "radio-group"} = assigns) do
assigns =
assign_new(assigns, :checked, fn -> nil end)
assigns = assign_new(assigns, :checked, fn -> nil end)

~H"""
<.field_wrapper errors={@errors} name={@name} class={@wrapper_class}>
Expand Down
6 changes: 2 additions & 4 deletions lib/petal_components/pagination.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ defmodule PetalComponents.Pagination do
end

defp get_box_class(item) do
base_classes =
"pc-pagination__item"
base_classes = "pc-pagination__item"

active_classes =
if item.current?,
do: "pc-pagination__item--is-current",
else:
"pc-pagination__item--is-not-current"
else: "pc-pagination__item--is-not-current"

rounded_classes =
case item do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule PetalComponents.MixProject do
use Mix.Project

@source_url "https://github.com/petalframework/petal_components"
@version "1.2.5"
@version "1.2.6"

def project do
[
Expand Down
6 changes: 5 additions & 1 deletion test/petal/dropdown_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ defmodule PetalComponents.DropdownTest do

html =
rendered_to_string(~H"""
<.dropdown class="dropdown_class" menu_items_wrapper_class="menu_items_wrapper_class" label="Dropdown">
<.dropdown
class="dropdown_class"
menu_items_wrapper_class="menu_items_wrapper_class"
label="Dropdown"
>
<.dropdown_menu_item class="dropdown_menu_item_class" type="button">
<Heroicons.home class="w-5 h-5 text-gray-500" /> Button item with icon
</.dropdown_menu_item>
Expand Down
2 changes: 1 addition & 1 deletion test/petal/icon_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule PetalComponents.IconTest do

html =
rendered_to_string(~H"""
<.icon name={:arrow_right} class="text-gray-300"/>
<.icon name={:arrow_right} class="text-gray-300" />
""")

assert html =~ "<svg"
Expand Down
8 changes: 5 additions & 3 deletions test/petal/rating_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule PetalComponents.RatingTest do

html =
rendered_to_string(~H"""
<.rating include_label rating={3.3} total={5}/>
<.rating include_label rating={3.3} total={5} />
""")

assert html =~ "pc-rating__star--filled"
Expand All @@ -21,10 +21,12 @@ defmodule PetalComponents.RatingTest do

html =
rendered_to_string(~H"""
<.rating include_label rating={3.3} total={5}/>
<.rating include_label rating={3.3} total={5} />
""")

filled_stars_count = html |> String.split("pc-rating__star--filled") |> length() |> Kernel.-(1)
filled_stars_count =
html |> String.split("pc-rating__star--filled") |> length() |> Kernel.-(1)

empty_stars_count = html |> String.split("pc-rating__star--empty") |> length() |> Kernel.-(1)
half_stars_count = html |> String.split("pc-rating__star--half") |> length() |> Kernel.-(1)

Expand Down

0 comments on commit bf79eb4

Please sign in to comment.