feat: introduce propTypes

This commit is contained in:
kasia.oczkowska
2024-02-29 09:53:07 +00:00
committed by Ali BARIN
parent bfc7d5d0dd
commit 7afdf43872
57 changed files with 1119 additions and 735 deletions

View File

@@ -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;