Brijesh619 commented on code in PR #728:
URL: https://github.com/apache/atlas/pull/728#discussion_r3829203032
##########
dashboard/src/components/muiComponents.tsx:
##########
@@ -68,6 +71,64 @@ const LightTooltip = styled(({ className, ...props }: any)
=> (
}
}));
+
+interface OverflowTooltipProps extends Omit<TooltipProps, 'children'> {
+ children: React.ReactElement;
+ wrapperComponent?: React.ElementType;
+ wrapperSx?: SxProps<Theme>;
+}
+
+const OverflowTooltip = ({ title, children, wrapperComponent, wrapperSx,
...props }: OverflowTooltipProps) => {
+ const textElementRef = React.useRef<HTMLElement>(null);
+ const [isOverflowed, setIsOverflowed] = React.useState(false);
+
+ const checkOverflow = () => {
+ if (textElementRef.current) {
+ setIsOverflowed(
+ textElementRef.current.scrollWidth > textElementRef.current.clientWidth
+ );
+ }
+ };
+
+ React.useLayoutEffect(() => {
+ checkOverflow();
+ window.addEventListener("resize", checkOverflow);
+ return () => {
+ window.removeEventListener("resize", checkOverflow);
+ };
+ }, [title]);
+
+ const child = (
+ <Box
+ component={wrapperComponent || 'span'}
Review Comment:
Fixed. The `wrapperComponent` prop and its associated unused logic were
completely removed during the refactor of `CustomButton` to the MUI `styled`
API.
##########
dashboard/src/components/muiComponents.tsx:
##########
@@ -51,6 +52,8 @@ import MuiAccordionSummary, {
AccordionSummaryProps
} from "@mui/material/AccordionSummary";
import MuiAccordionDetails from "@mui/material/AccordionDetails";
+import { TooltipProps } from '@mui/material/Tooltip';
Review Comment:
Fixed. Ensured that all imports and inline strings throughout
`muiComponents.tsx` now consistently use double quotes to match the rest of the
file.
Refactored `CustomButton` to use MUI's `styled` API instead of inline `sx`
objects with `!important` tags for a cleaner and more maintainable architecture.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]