Improve ci action icon function

This commit is contained in:
Filipa Lacerda 2017-05-11 12:33:05 +01:00
parent 2e92c5c458
commit ba6f263dd2
1 changed files with 13 additions and 18 deletions

View File

@ -3,24 +3,19 @@ import retrySVG from 'icons/_icon_action_retry.svg';
import playSVG from 'icons/_icon_action_play.svg'; import playSVG from 'icons/_icon_action_play.svg';
import stopSVG from 'icons/_icon_action_stop.svg'; import stopSVG from 'icons/_icon_action_stop.svg';
/**
* For the provided action returns the respective SVG
*
* @param {String} action
* @return {SVG|String}
*/
export default function getActionIcon(action) { export default function getActionIcon(action) {
let icon; const icons = {
switch (action) { icon_action_cancel: cancelSVG,
case 'icon_action_cancel': icon_action_play: playSVG,
icon = cancelSVG; icon_action_retry: retrySVG,
break; icon_action_stop: stopSVG,
case 'icon_action_retry': };
icon = retrySVG;
break;
case 'icon_action_play':
icon = playSVG;
break;
case 'icon_action_stop':
icon = stopSVG;
break;
default:
icon = '';
}
return icon; return icons[action] || '';
} }