From 67d89885fb73de88e82fb68a28a24f86b2c8cd1a Mon Sep 17 00:00:00 2001 From: Matt Kirby <MattJKirby@outlook.com> Date: Sat, 11 Mar 2023 22:41:34 +0000 Subject: [PATCH] Added new avater component --- .../src/components/profile/Avatar.tsx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 daily-thought-frontend/src/components/profile/Avatar.tsx diff --git a/daily-thought-frontend/src/components/profile/Avatar.tsx b/daily-thought-frontend/src/components/profile/Avatar.tsx new file mode 100644 index 00000000..a085e1e8 --- /dev/null +++ b/daily-thought-frontend/src/components/profile/Avatar.tsx @@ -0,0 +1,30 @@ +import { User } from '@/types/user'; +import { FC, PropsWithChildren } from 'react'; +import styles from '../../styles/Avatar.module.css' +import { generateRandomLinearGradient } from '../post/Utils'; + +type AvatarProps ={ + User: User +} + +const Avatar:FC<PropsWithChildren<AvatarProps>> = ({ + User +}) => { + + return ( + <div className={styles.avatar} style={{backgroundImage: generateRandomLinearGradient(User.Colors, true)}}> + {User.Avatar && + <div> + + </div> + } + {!User.Avatar && + <div> + <p>{User.Username[0]}</p> + </div> + } + </div> + ) +} + +export default Avatar; \ No newline at end of file -- GitLab