Skip to content

Commit 5d53c59

Browse files
committed
delete helper function
1 parent 7309a11 commit 5d53c59

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

src/components/Button/helper.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import SpinnerLoading from '../../assets/icons/loaders/Spinner';
44
import CircularLoading from '../../assets/icons/loaders/Circular';
55

66
import { LoadingIconProps } from './types';
7-
import Iconslist from '../../assets/icons/vant-icons/config';
87

98
export const renderLoadingIcon = ({
109
className,
@@ -52,13 +51,3 @@ export const colorType = (colorHex: string): string => {
5251
const result = '#' + colorHex;
5352
return result;
5453
};
55-
56-
export const iconType = (icon: string): boolean => {
57-
if (
58-
Iconslist.basic.includes(icon) ||
59-
Iconslist.outline.includes(icon) ||
60-
Iconslist.filled.includes(icon)
61-
)
62-
return true;
63-
return false;
64-
};

src/components/Button/index.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import React from 'react';
22

3-
import {
4-
renderLoadingIcon,
5-
getContrastTextColor,
6-
colorType,
7-
iconType
8-
} from './helper';
3+
import { renderLoadingIcon, getContrastTextColor, colorType } from './helper';
94
import classnames from '../../utils/classNames';
105

116
import { Props } from './types';
@@ -131,9 +126,9 @@ export default function Button({
131126

132127
return (
133128
<CustomTag {...props}>
134-
{iconType(`${icon}`)
135-
? icon && <Icon name={icon} size={NAV_ICON_SIZE} />
136-
: icon && <img src={icon} alt='button icon' />}
129+
{icon?.includes('.') || icon?.includes('http')
130+
? icon && <img src={icon} alt='button icon' />
131+
: icon && <Icon name={icon} size={NAV_ICON_SIZE} />}
137132
{loading
138133
? renderLoadingIcon({
139134
className: loadingType

0 commit comments

Comments
 (0)