Skip to content

Commit

Permalink
Renovation: Button.icon refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Churkin committed Feb 10, 2020
1 parent 9685bca commit 0a4b265
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions js/core/utils/icon.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import $ from '../../core/renderer';

const ICON_CLASS = 'dx-icon';
const SVG_ICON_CLASS = 'dx-svg-icon';

const getImageSourceType = (source) => {
export const getImageSourceType = (source) => {
if(!source || typeof source !== 'string') {
return false;
}
Expand All @@ -27,7 +26,7 @@ const getImageSourceType = (source) => {
return false;
};

const getImageContainer = (source) => {
export const getImageContainer = (source) => {
switch(getImageSourceType(source)) {
case 'image':
return $('<img>').attr('src', source).addClass(ICON_CLASS);
Expand All @@ -36,11 +35,8 @@ const getImageContainer = (source) => {
case 'dxIcon':
return $('<i>').addClass(`${ICON_CLASS} ${ICON_CLASS}-${source}`);
case 'svg':
return $('<i>').addClass(`${ICON_CLASS} ${SVG_ICON_CLASS}`).append(source);
return $('<i>').addClass(`${ICON_CLASS} dx-svg-icon`).append(source);
default:
return null;
}
};

exports.getImageSourceType = getImageSourceType;
exports.getImageContainer = getImageContainer;

0 comments on commit 0a4b265

Please sign in to comment.