Skip to content

Commit d0d4fa6

Browse files
committed
resolve conflict
2 parents d5abc76 + 64b256f commit d0d4fa6

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/components/Button/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ a.#{$baseClass} {
4040
opacity: 0;
4141
content: ' ';
4242
}
43+
&:first-child {
44+
i {
45+
margin: 0px;
46+
}
47+
}
4348

4449
&:active {
4550
&::before {

src/components/Button/index.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ export const BlockButtons = () => (
128128

129129
export const IconButton = () => (
130130
<div className='container button'>
131-
<Button icon='https://img.yzcdn.cn/vant/logo.png'>
131+
<Button icon='star-o' type='primary' />
132+
<Button icon='star-o' type='info'>
133+
Custom Icon Button
134+
</Button>
135+
<Button icon='https://img.yzcdn.cn/vant/logo.png' type='primary'>
132136
Custom Icon Button
133137
</Button>
134138
</div>

src/components/Button/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { renderLoadingIcon, getContrastTextColor, colorType } from './helper';
44
import classnames from '../../utils/classNames';
55

66
import { Props } from './types';
7+
import Icon from '../Icons';
78

89
import './index.scss';
910

@@ -123,9 +124,13 @@ export default function Button({
123124
});
124125
}
125126

127+
const NAV_ICON_SIZE = '16px';
128+
126129
return (
127130
<CustomTag {...props}>
128-
{icon && <img src={icon} alt='button icon' />}
131+
{icon?.includes('.') || icon?.includes('http')
132+
? icon && <img src={icon} alt='button icon' />
133+
: icon && <Icon name={icon} size={NAV_ICON_SIZE} />}
129134
{loading
130135
? renderLoadingIcon({
131136
className: loadingType

0 commit comments

Comments
 (0)