forked from sombochea/verdaccio-ui
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';
|
||||
Reference in New Issue
Block a user