feat: introduce propTypes
This commit is contained in:

committed by
Ali BARIN

parent
bfc7d5d0dd
commit
7afdf43872
@@ -1,9 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Avatar from '@mui/material/Avatar';
|
||||
const inlineImgStyle = {
|
||||
objectFit: 'contain',
|
||||
};
|
||||
export default function AppIcon(props) {
|
||||
function AppIcon(props) {
|
||||
const { name, url, color, sx = {}, variant = 'square', ...restProps } = props;
|
||||
const initialLetter = name?.[0];
|
||||
return (
|
||||
@@ -14,8 +15,22 @@ export default function AppIcon(props) {
|
||||
imgProps={{ style: inlineImgStyle }}
|
||||
src={url}
|
||||
alt={name}
|
||||
children={initialLetter}
|
||||
{...restProps}
|
||||
/>
|
||||
>
|
||||
{initialLetter}
|
||||
</Avatar>
|
||||
);
|
||||
}
|
||||
|
||||
AppIcon.propTypes = {
|
||||
name: PropTypes.string,
|
||||
url: PropTypes.string,
|
||||
color: PropTypes.string,
|
||||
variant: PropTypes.oneOfType([
|
||||
PropTypes.oneOf(['circular', 'rounded', 'square']),
|
||||
PropTypes.string,
|
||||
]),
|
||||
sx: PropTypes.object,
|
||||
};
|
||||
|
||||
export default AppIcon;
|
||||
|
Reference in New Issue
Block a user