Skip to content

Commit

Permalink
fix: standalone action disabled and enabled classes (#3520)
Browse files Browse the repository at this point in the history
* WIP fix: standalone actions disabled and enabled classes

* reminder

* wip
  • Loading branch information
Paul-Bob authored Dec 13, 2024
1 parent 4de03cc commit 5a8f449
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/avo/button_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def args
end

def button_classes
classes = "button-component inline-flex flex-grow-0 items-center font-semibold leading-6 fill-current whitespace-nowrap transition duration-100 transform transition duration-100 cursor-pointer disabled:cursor-not-allowed disabled:opacity-70 justify-center #{@class}"
classes = "button-component inline-flex flex-grow-0 items-center font-semibold leading-6 fill-current whitespace-nowrap transition duration-100 transform transition duration-100 cursor-pointer disabled:cursor-not-allowed disabled:opacity-60 data-[disabled='true']:opacity-60 justify-center #{@class}"

# For non-icon-styled buttons we should not add borders.
classes += " border active:outline active:outline-1" unless is_icon?
Expand Down
3 changes: 2 additions & 1 deletion app/components/avo/resource_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def render_action(action)
tippy: action.title ? :tooltip : nil,
action: "click->actions-picker#visitAction",
turbo_prefetch: false,
"actions-picker-target": action.action.standalone ? "standaloneAction" : "resourceAction",
# When action has record present behave as standalone and keep always active.
"actions-picker-target": (action.action.standalone || action.action.record.present?) ? "standaloneAction" : "resourceAction",
disabled: action.action.disabled?
} do
action.label
Expand Down

0 comments on commit 5a8f449

Please sign in to comment.