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

Commit

Permalink
feat(notification): pulled status classname into util. some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Leyva committed Oct 1, 2018
1 parent 2e62d46 commit 739f69c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/components/Notification/NotificationBody.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { getAlertIconClassName } from '../../util/getAlertIconClassName'
import NotificationMessage from './NotificationMessage'
import NotificationEmpty from './NotificationEmpty'

Expand All @@ -15,30 +16,12 @@ const NotificationBody = props => {
<div className='notificationBody' {...rest}>
{notifications.map(
({ id, type, title, description, timeStamp, isMsgRead }) => {
let icon = ''
switch (type) {
case 'success':
icon = 'icon_error-triangle_alt'
break
case 'info':
icon = 'icon_error-triangle_alt'
break
case 'warning':
icon = 'icon_error-triangle_alt'
break
case 'error':
icon = 'icon_error-circle_alt'
break
default:
icon = 'icon_check_alt2'
}
const icon = getAlertIconClassName(type)
const options = {
id,
type,
title,
description,
timeStamp,
isMsgRead,
icon: icon,
removeItem: removeItem
}
Expand Down
7 changes: 7 additions & 0 deletions src/util/getAlertIconClassName.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function getAlertIconClassName (status) {
console.log(status)
if (status === 'success') return 'icon_check_alt2'
if (status === 'information' || status === 'info') return 'ei icon_info_alt'
if (status === 'warning') return 'ei icon_error-triangle_alt'
if (status === 'error') return 'ei icon_error-circle_alt'
}

0 comments on commit 739f69c

Please sign in to comment.