Skip to content

Commit

Permalink
make icon in panel table have circle background on hover (#5197)
Browse files Browse the repository at this point in the history
* make icon in panel table have circle background on hover

* cleanup

* fix icon
  • Loading branch information
CamronStaley authored Nov 27, 2024
1 parent 9f690fe commit 7287351
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
44 changes: 30 additions & 14 deletions app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ function Action(props: ActionPropsType) {
const { label, name, onClick, icon, variant, mode, color, size, tooltip } =
props;
const resolvedColor = color ? getColorByCode(color) : undefined;

const Icon = icon ? (
<MuiIconFont name={icon} sx={{ color: resolvedColor }} />
<MuiIconFont
name={icon}
sx={{
color: resolvedColor,
}}
/>
) : null;

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

const content =
mode === "inline" ? (
<Button
variant={variant}
startIcon={Icon}
onClick={handleClick}
sx={{
color: resolvedColor,
padding: size === "small" ? 0 : undefined,
minWidth: size === "small" ? 40 : undefined,
}}
>
{label}
</Button>
label ? (
<Button
variant={variant}
startIcon={Icon}
onClick={handleClick}
sx={{
color: resolvedColor,
padding: size === "small" ? 0 : undefined,
minWidth: size === "small" ? 40 : undefined,
}}
>
{label}
</Button>
) : (
<IconButton
onClick={handleClick}
size={size}
sx={{
color: resolvedColor,
}}
>
{Icon}
</IconButton>
)
) : (
<MenuItem onClick={handleClick}>
{Icon && <ListItemIcon>{Icon}</ListItemIcon>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ export default function TableView(props: ViewPropsType) {
: "unset",
}}
>
{currentRowHasActions && (
{currentRowHasActions ? (
<ActionsMenu
actions={getRowActions(rowIndex)}
size={size}
maxInline={max_inline_actions}
/>
) : (
<Box sx={{ minHeight: "32px" }} />
)}
</TableCell>
)}
Expand Down

0 comments on commit 7287351

Please sign in to comment.