Skip to content

Commit 7287351

Browse files
authored
make icon in panel table have circle background on hover (#5197)
* make icon in panel table have circle background on hover * cleanup * fix icon
1 parent 9f690fe commit 7287351

File tree

2 files changed

+33
-15
lines changed

2 files changed

+33
-15
lines changed

app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ function Action(props: ActionPropsType) {
7777
const { label, name, onClick, icon, variant, mode, color, size, tooltip } =
7878
props;
7979
const resolvedColor = color ? getColorByCode(color) : undefined;
80-
8180
const Icon = icon ? (
82-
<MuiIconFont name={icon} sx={{ color: resolvedColor }} />
81+
<MuiIconFont
82+
name={icon}
83+
sx={{
84+
color: resolvedColor,
85+
}}
86+
/>
8387
) : null;
8488

8589
const handleClick = useCallback(
@@ -91,18 +95,30 @@ function Action(props: ActionPropsType) {
9195

9296
const content =
9397
mode === "inline" ? (
94-
<Button
95-
variant={variant}
96-
startIcon={Icon}
97-
onClick={handleClick}
98-
sx={{
99-
color: resolvedColor,
100-
padding: size === "small" ? 0 : undefined,
101-
minWidth: size === "small" ? 40 : undefined,
102-
}}
103-
>
104-
{label}
105-
</Button>
98+
label ? (
99+
<Button
100+
variant={variant}
101+
startIcon={Icon}
102+
onClick={handleClick}
103+
sx={{
104+
color: resolvedColor,
105+
padding: size === "small" ? 0 : undefined,
106+
minWidth: size === "small" ? 40 : undefined,
107+
}}
108+
>
109+
{label}
110+
</Button>
111+
) : (
112+
<IconButton
113+
onClick={handleClick}
114+
size={size}
115+
sx={{
116+
color: resolvedColor,
117+
}}
118+
>
119+
{Icon}
120+
</IconButton>
121+
)
106122
) : (
107123
<MenuItem onClick={handleClick}>
108124
{Icon && <ListItemIcon>{Icon}</ListItemIcon>}

app/packages/core/src/plugins/SchemaIO/components/TableView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,14 @@ export default function TableView(props: ViewPropsType) {
222222
: "unset",
223223
}}
224224
>
225-
{currentRowHasActions && (
225+
{currentRowHasActions ? (
226226
<ActionsMenu
227227
actions={getRowActions(rowIndex)}
228228
size={size}
229229
maxInline={max_inline_actions}
230230
/>
231+
) : (
232+
<Box sx={{ minHeight: "32px" }} />
231233
)}
232234
</TableCell>
233235
)}

0 commit comments

Comments
 (0)