Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: LEAP-1356: Add custom button props #6787

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const TableRow = observer(({ data, even, style, wrapperStyle, onClick, st

return (
<div className={rowWrapperCN.mod(mods).toString()} style={wrapperStyle} onClick={(e) => onClick?.(data, e)}>
<div className={tableRowCN.toString()} style={style}>
<div className={tableRowCN.toString()} style={style} data-leave={true}>
{columns.map((col) => {
return <CellRenderer key={col.id} col={col} data={data} cellViews={cellViews} decoration={decoration} />;
})}
Expand Down
3 changes: 2 additions & 1 deletion web/libs/datamanager/src/components/Common/Tabs/Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Tabs = ({
</Droppable>
</DragDropContext>
{allowedActions.add !== false && (
<Button className={tabsCN.elem("add").toString()} type="text" onClick={onAdd} icon={addIcon} />
<Button className={tabsCN.elem("add").toString()} type="text" onClick={onAdd} icon={addIcon} data-leave />
)}
</span>
<span className={tabsCN.elem("extra").toString()}>{tabBarExtraContent}</span>
Expand Down Expand Up @@ -140,6 +140,7 @@ export const TabsItem = ({
.toString()}
onClick={() => switchTab?.(tab)}
title={currentTitle}
data-leave
>
{renameMode ? (
<Input
Expand Down
8 changes: 6 additions & 2 deletions web/libs/datamanager/src/components/Common/Tabs/TabsMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export const TabsMenu = ({ onClick, editable = true, closable = true, clonable =
title: "Duplicate",
enabled: !virtual && clonable,
action: () => onClick("duplicate"),
willLeave: true,
},
{
key: "save",
title: "Save",
enabled: virtual,
action: () => onClick("save"),
willLeave: true,
},
],
[editable, closable, clonable, virtual],
Expand All @@ -32,7 +34,7 @@ export const TabsMenu = ({ onClick, editable = true, closable = true, clonable =
<Menu size="medium" onClick={(e) => e.domEvent.stopPropagation()}>
{items.map((item) =>
item.enabled ? (
<Menu.Item key={item.key} onClick={item.action}>
<Menu.Item key={item.key} onClick={item.action} data-leave={item.willLeave}>
{item.title}
</Menu.Item>
) : null,
Expand All @@ -41,7 +43,9 @@ export const TabsMenu = ({ onClick, editable = true, closable = true, clonable =
{closable ? (
<>
{showDivider && <Menu.Divider />}
<Menu.Item onClick={() => onClick("close")}>Close</Menu.Item>
<Menu.Item onClick={() => onClick("close")} data-leave>
Close
</Menu.Item>
</>
) : null}
</Menu>
Expand Down
8 changes: 7 additions & 1 deletion web/libs/editor/src/components/BottomBar/Controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ const ControlButton = observer(({ button, disabled, onClick }: ControlButtonProp

return (
<ButtonTooltip title={button.tooltip ?? ""}>
<Button aria-label={button.ariaLabel} disabled={button.disabled || disabled} look={look} onClick={onClick}>
<Button
{...button.props}
aria-label={button.ariaLabel}
disabled={button.disabled || disabled}
look={look}
onClick={onClick}
>
{button.title}
</Button>
</ButtonTooltip>
Expand Down
1 change: 1 addition & 0 deletions web/libs/editor/src/stores/CustomButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const CustomButton = types
tooltip: types.maybe(types.string),
ariaLabel: types.maybe(types.string),
disabled: types.maybe(types.boolean),
props: types.maybe(types.frozen()),
})
.actions((self) => ({
updateState(newState: CustomButtonSnType) {
Expand Down
Loading