some avatar stuff but will continue this part later

This commit is contained in:
talksik
2022-05-28 00:07:42 -05:00
parent a576d40375
commit 76d229debd
2 changed files with 35 additions and 1 deletions
@@ -0,0 +1,29 @@
import { Avatar, AvatarGroup, SxProps } from '@mui/material';
import React from 'react';
/**
*
* for multiple avatars, will render all in a folder
* takes into account size as well
*/
export default function NirvanaAvatar({
avatars,
size = 'default',
}: {
size?: 'large' | 'small' | 'default';
avatars: { src: string; alt: string }[];
}) {
const sx: SxProps = size === 'small' ? { height: 25, width: 25 } : {};
if (avatars?.length === 1) {
return <Avatar alt={avatars[0].alt} src={avatars[0].src} sx={sx} />;
}
return (
<AvatarGroup>
{avatars.map((avatar, index) => (
<Avatar key={`${avatar.alt}-${index}`} alt={avatar.alt} sx={sx} src={avatar.src} />
))}
</AvatarGroup>
);
}
+6 -1
View File
@@ -22,6 +22,7 @@ import { FiActivity, FiInbox, FiSearch } from 'react-icons/fi';
import KeyboardShortcutLabel from './KeyboardShortcutLabel';
import { useSnackbar } from 'notistack';
import { useKey } from 'react-use';
import NirvanaAvatar from './NirvanaAvatar';
export default function Terminal() {
const { enqueueSnackbar } = useSnackbar();
@@ -120,7 +121,11 @@ export default function Terminal() {
<ListItem>
<ListItemAvatar>
<Avatar alt={'Arjun Patel'} src="https://mui.com/static/images/avatar/3.jpg" />
<NirvanaAvatar
avatars={[
{ alt: 'Arjun Patel', src: 'https://mui.com/static/images/avatar/3.jpg' },
]}
/>
</ListItemAvatar>
<ListItemText