Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 739f69c

Browse files
author
Andrew Leyva
committed
feat(notification): pulled status classname into util. some cleanup
1 parent 2e62d46 commit 739f69c

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/components/Notification/NotificationBody.jsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import { getAlertIconClassName } from '../../util/getAlertIconClassName'
23
import NotificationMessage from './NotificationMessage'
34
import NotificationEmpty from './NotificationEmpty'
45

@@ -15,30 +16,12 @@ const NotificationBody = props => {
1516
<div className='notificationBody' {...rest}>
1617
{notifications.map(
1718
({ id, type, title, description, timeStamp, isMsgRead }) => {
18-
let icon = ''
19-
switch (type) {
20-
case 'success':
21-
icon = 'icon_error-triangle_alt'
22-
break
23-
case 'info':
24-
icon = 'icon_error-triangle_alt'
25-
break
26-
case 'warning':
27-
icon = 'icon_error-triangle_alt'
28-
break
29-
case 'error':
30-
icon = 'icon_error-circle_alt'
31-
break
32-
default:
33-
icon = 'icon_check_alt2'
34-
}
19+
const icon = getAlertIconClassName(type)
3520
const options = {
3621
id,
3722
type,
3823
title,
3924
description,
40-
timeStamp,
41-
isMsgRead,
4225
icon: icon,
4326
removeItem: removeItem
4427
}

src/util/getAlertIconClassName.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function getAlertIconClassName (status) {
2+
console.log(status)
3+
if (status === 'success') return 'icon_check_alt2'
4+
if (status === 'information' || status === 'info') return 'ei icon_info_alt'
5+
if (status === 'warning') return 'ei icon_error-triangle_alt'
6+
if (status === 'error') return 'ei icon_error-circle_alt'
7+
}

0 commit comments

Comments
 (0)