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:
- Distinguish between "unread" and "read" notifications
- Select "Mark all as read" to toggle the visual state of the unread notifications and set the number of unread messages to zero
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Solution URL: github.com/miranlegin/fem-notifications-page
- Live Site URL: frontend-mentor-challenge-25.netlify.app
- React with Vite
- Vanilla CSS
After creating static version of this challenge i extracted the code into components and made initial state of the app. Then all there is needed to do was handle some logic for clearing the unread messages and updating message count. Snippet below is responsible for these functionality.
function clearNotificationsHandler() {
const clearedNotifications = notifications.map((notification) => ({
...notification,
status: true,
}));
setNotifications(clearedNotifications);
}
const unreadNotifications = notifications.filter(
(notification) => notification.status === false
);
- react.dev - Goto place for everything React!
- Frontend Mentor - @miranlegin