This is a solution to the Notifications page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
Desktop Version
Mobile Version
This challenge i'm learning a lot about props to separate data(etc:dummy) with component's, and then using ternary condition for object to call component.
See code below:
import AvatarNotif from "./AvatarNotif";
import PrivateMessage from "./PrivateMessage";
import { accounts } from "../constants";
const CardAvatar = () => {
return (
<div className='just css class'>
{accounts.map((account) => (
<AvatarNotif
srcAvatar={account.avatar}
name={account.name}
altAvatar={account.alt}
about={account.about}
destiny={account.destiny}
status={account.status}
time={account.time}
imageCommented={account.imageCommented}
altImageCommented={account.altImageCommented}
classAbout={account.classAbout}
classCard={account.classCard}
children={
account.isHasChildren ? <PrivateMessage pm={account.pm} /> : ""
}
/>
))}
</div>
);
};
import Avatar from "./Avatar";
const AvatarNotif = (props: any) => {
const {
srcAvatar,
name,
about,
destiny,
time,
classCard = "just css clas",
children,
altAvatar,
altImageCommented,
imageCommented,
status,
classAbout = "just css class",
} = props;
};
import {
AvatarAngelaGray,
} from "../assets/IndexImages";
export const accounts = [
{
id: "mark-webber",
avatar: AvatarMarkWebber,
name: "Mark Webber ",
alt: "Mark Webber Avatar",
about: "reacted to your recent posts ",
destiny: "My first tournament today! ",
status: " 🔴 ",
time: "1m ago",
pm: "",
imageCommented: "",
altImageCommented: "",
isHasChildren: false,
},
];
...
For continue development like this challenge, i want give few hooks with useStats in notif and number counter, if client doing click and then counter do decrement with disable blue highlight, same with function "mark all as read".