mirror of
https://github.com/SomboChea/ui
synced 2026-01-16 16:15:45 +07:00
fix: introduced forwardRef (#163)
This commit is contained in:
committed by
Juan Picado @jotadeveloper
parent
909a8d9fb8
commit
626bcce5cb
13
src/muiComponents/Avatar/Avatar.tsx
Normal file
13
src/muiComponents/Avatar/Avatar.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import { default as MaterialUIAvatar, AvatarProps } from '@material-ui/core/Avatar';
|
||||
|
||||
// The default element type of MUI's Avatar is 'div' and we don't allow the change of this prop
|
||||
type AvatarRef = HTMLElementTagNameMap['div'];
|
||||
|
||||
/* eslint-disable verdaccio/jsx-spread */
|
||||
// eslint-disable-next-line react/display-name
|
||||
const Avatar = forwardRef<AvatarRef, AvatarProps>(function Avatar(props, ref) {
|
||||
return <MaterialUIAvatar {...props} ref={ref} />;
|
||||
});
|
||||
|
||||
export default Avatar;
|
||||
1
src/muiComponents/Avatar/index.ts
Normal file
1
src/muiComponents/Avatar/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Avatar';
|
||||
@@ -1,12 +1,12 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import { default as MuiIconButton, IconButtonProps } from '@material-ui/core/IconButton';
|
||||
import { default as MaterialUIIconButton, IconButtonProps } from '@material-ui/core/IconButton';
|
||||
|
||||
type IconButtonRef = HTMLElementTagNameMap['button'];
|
||||
|
||||
/* eslint-disable verdaccio/jsx-spread */
|
||||
// eslint-disable-next-line react/display-name
|
||||
const IconButton = forwardRef<IconButtonRef, IconButtonProps>(function IconButton(props, ref) {
|
||||
return <MuiIconButton {...props} ref={ref} />;
|
||||
return <MaterialUIIconButton {...props} ref={ref} />;
|
||||
});
|
||||
|
||||
export default IconButton;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import { default as TextFieldMaterialUI, TextFieldProps } from '@material-ui/core/TextField';
|
||||
import { default as MaterialUITextField, TextFieldProps } from '@material-ui/core/TextField';
|
||||
|
||||
// The default element type of MUI's TextField is 'div'
|
||||
type TextFieldRef = HTMLElementTagNameMap['div'];
|
||||
@@ -8,7 +8,7 @@ type TextFieldRef = HTMLElementTagNameMap['div'];
|
||||
// eslint-disable-next-line react/display-name
|
||||
const TextField = forwardRef<TextFieldRef, TextFieldProps>(function ToolTip({ InputProps, classes, ...props }, ref) {
|
||||
return (
|
||||
<TextFieldMaterialUI
|
||||
<MaterialUITextField
|
||||
{...props}
|
||||
InputProps={{
|
||||
...InputProps,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import { default as MuiTooltip, TooltipProps } from '@material-ui/core/Tooltip';
|
||||
import { default as MaterialUITooltip, TooltipProps } from '@material-ui/core/Tooltip';
|
||||
|
||||
// The default element type of MUI's Tooltip is 'div' and the change of this prop is not allowed
|
||||
type TooltipRef = HTMLElementTagNameMap['div'];
|
||||
@@ -7,7 +7,7 @@ type TooltipRef = HTMLElementTagNameMap['div'];
|
||||
/* eslint-disable verdaccio/jsx-spread */
|
||||
// eslint-disable-next-line react/display-name
|
||||
const Tooltip = forwardRef<TooltipRef, TooltipProps>(function ToolTip(props, ref) {
|
||||
return <MuiTooltip {...props} innerRef={ref} />;
|
||||
return <MaterialUITooltip {...props} innerRef={ref} />;
|
||||
});
|
||||
|
||||
export default Tooltip;
|
||||
|
||||
Reference in New Issue
Block a user