Skip to content

Commit 15070fd

Browse files
committed
revert(admin-ui): restore original accordion trigger behavior
- Move open/close indicator back to right side after actions - Remove `isInteractable` variable in favor of inline conditions - Add separator between actions and indicator when both present - Change icon conditional from `&&` to ternary for consistency This restores the original layout behavior while maintaining cleaner conditional logic.
1 parent 874b820 commit 15070fd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/admin-ui/src/Accordion/components/AccordionTrigger.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ReactComponent as KeyboardArrowDownIcon } from "@webiny/icons/keyboard_
33
import { Collapsible as CollapsiblePrimitive } from "radix-ui";
44
import { cn } from "~/utils.js";
55
import { type AccordionItemProps } from "./AccordionItem.js";
6+
import { AccordionItemAction } from "./AccordionItemAction.js";
67
import { Icon } from "~/Icon/index.js";
78
import { AccordionItemDragHandle } from "~/Accordion/components/AccordionItemDragHandle.js";
89

@@ -50,8 +51,6 @@ const AccordionTrigger = ({
5051
};
5152
}, [interactive]);
5253

53-
const isInteractable = Boolean(actions && interactive);
54-
5554
const baseClasses = "wby-group/trigger wby-w-full wby-flex wby-items-center wby-relative";
5655
const focusClasses =
5756
"focus-visible:wby-outline-none focus-visible:wby-border-none focus-visible:wby-ring-sm focus-visible:wby-ring-primary-dimmed";
@@ -79,14 +78,12 @@ const AccordionTrigger = ({
7978
)}
8079
>
8180
{draggable ? <AccordionItemDragHandle /> : null}
82-
{isInteractable ? <OpenCloseIndicator className="wby-pl-md" /> : null}
83-
8481
<div
8582
className={
8683
"wby-w-full wby-flex wby-justify-between wby-items-center wby-px-md wby-py-sm-extra"
8784
}
8885
>
89-
{icon && <div className={"wby-mr-md"}>{icon}</div>}
86+
{icon ? <div className={"wby-mr-md"}>{icon}</div> : null}
9087
<div
9188
className={"wby-flex wby-flex-col wby-gap-xxs wby-flex-grow wby-text-left"}
9289
>
@@ -99,7 +96,9 @@ const AccordionTrigger = ({
9996
</div>
10097
<div className={"wby-flex wby-gap-xs"}>
10198
{actions}
102-
{!isInteractable ? <OpenCloseIndicator /> : null}
99+
{/* No need to show the separator if there are no actions and the item is not interactive. */}
100+
{actions && interactive ? <AccordionItemAction.Separator /> : null}
101+
{interactive ? <OpenCloseIndicator /> : null}
103102
</div>
104103
</div>
105104
</div>

0 commit comments

Comments
 (0)