Created
February 15, 2018 21:48
-
-
Save agnanachandran/0f27ed52b4d5112cdc0a128d4eafb2df to your computer and use it in GitHub Desktop.
views/notifications_view.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface NotificationsViewProps { | |
unreadNotifications: Notification[]; | |
readNotifications: Notification[]; | |
onMarkAsRead: (notification: Notification) => void; | |
} | |
class NotificationsView extends React.Component<NotificationsViewProps, {}> { | |
render(): JSX.Element { | |
return ( | |
<div> | |
<h1>Unread Notifications</h1> | |
{ this.props.unreadNotifications && ( | |
<div> | |
{ this.props.unreadNotifications.map((notification) => ( | |
<div key={ notification.id }> | |
{ notification.content } | |
<span onClick={ () => this.props.onMarkAsRead(notification) }> | |
Mark as Read | |
</span> | |
</div> | |
)) } | |
</div> | |
) } | |
<h1>Read Notifications</h1> | |
{ this.props.readNotifications && ( | |
<div> | |
{ this.props.readNotifications.map((notification) => ( | |
<div key={ notification.id }> | |
{ notification.content } | |
</div> | |
)) } | |
</div> | |
) } | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment