Skip to content

Commit

Permalink
Merge pull request #85 from PhlexUI/cirdes/remove-attribute-merger
Browse files Browse the repository at this point in the history
Using mix instead of attribute merger
  • Loading branch information
cirdes authored Aug 21, 2024
2 parents de4c84f + faec591 commit 7fba0df
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 133 deletions.
64 changes: 0 additions & 64 deletions lib/phlex_ui/attribute_merger.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/phlex_ui/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Base < Phlex::HTML
attr_reader :attrs

def initialize(**user_attrs)
@attrs = PhlexUI::AttributeMerger.new(default_attrs, user_attrs).call
@attrs = mix(default_attrs, user_attrs)
@attrs[:class] = ::TailwindMerge::Merger.new.merge(@attrs[:class]) if @attrs[:class]
end

Expand Down
65 changes: 0 additions & 65 deletions lib/rbui/attribute_merger.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/rbui/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Base < Phlex::HTML
attr_reader :attrs

def initialize(**user_attrs)
@attrs = AttributeMerger.new(default_attrs, user_attrs).call
@attrs = mix(default_attrs, user_attrs)
@attrs[:class] = ::TailwindMerge::Merger.new.merge(@attrs[:class]) if @attrs[:class]
end

Expand Down
4 changes: 2 additions & 2 deletions lib/rbui/theme_toggle/theme_toggle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ def view_template(&)
end

def light_mode(**user_attrs, &)
light_attrs = AttributeMerger.new(default_light_attrs, user_attrs).call
light_attrs = mix(default_light_attrs, user_attrs)
div(**light_attrs, &)
end

def dark_mode(**user_attrs, &)
dark_attrs = AttributeMerger.new(default_dark_attrs, user_attrs).call
dark_attrs = mix(default_dark_attrs, user_attrs)
div(**dark_attrs, &)
end

Expand Down

0 comments on commit 7fba0df

Please sign in to comment.