Skip to content

Commit

Permalink
review changes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Br2850 committed Oct 22, 2024
1 parent 3d67489 commit 6f81d66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 35 deletions.
52 changes: 23 additions & 29 deletions app/packages/components/src/components/MuiIconFont/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,30 @@ import { Icon, IconProps } from "@mui/material";
import "material-icons/iconfont/material-icons.css";
import React from "react";

// Available Icons: https://github.com/marella/material-icons?tab=readme-ov-file#available-icons
export default function MuiIconFont(props: MuiIconFontProps) {
const { name, variant, ...iconProps } = props;

let icon = <Icon {...iconProps}>{name}</Icon>;

if (variant === "outlined") {
icon = (
<Icon {...iconProps} className="material-icons-outlined">
{name}
</Icon>
);
} else if (variant === "rounded") {
icon = (
<Icon {...iconProps} className="material-icons-rounded">
{name}
</Icon>
);
} else if (variant === "sharp") {
icon = (
<Icon {...iconProps} className="material-icons-sharp">
{name}
</Icon>
);
}

return icon;
}

type MuiIconFontProps = IconProps & {
name: string;
variant?: "filled" | "outlined" | "rounded" | "sharp";
};

const defaultProps = { variant: "filled" as const };

// Available Icons: https://github.com/marella/material-icons?tab=readme-ov-file#available-icons
const MuiIconFont = React.memo(function MuiIconFont(props: MuiIconFontProps) {
const { name, variant = defaultProps.variant, ...iconProps } = props;

const variantClassMap = {
filled: "",
outlined: "material-icons-outlined",
rounded: "material-icons-rounded",
sharp: "material-icons-sharp",
};

const className = variant ? variantClassMap[variant] : "";

return (
<Icon {...iconProps} className={className || undefined}>
{name}
</Icon>
);
});
export default MuiIconFont;
6 changes: 0 additions & 6 deletions fiftyone/operators/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2358,12 +2358,6 @@ class ModalView(Button):
"""

def __init__(self, **kwargs):
if "primaryCallback" not in kwargs or not callable(
kwargs["primaryCallback"]
):
raise ValueError(
"The 'primaryCallback' parameter is missing or must be function that is callable."
)
super().__init__(**kwargs)


Expand Down

0 comments on commit 6f81d66

Please sign in to comment.