Skip to content

Commit 17a500b

Browse files
committed
addressed feedbacks
1 parent b283b93 commit 17a500b

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

src/components/Button/index.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,14 @@ a.#{$baseClass} {
157157
object-position: 50% 50%;
158158
margin-right: 5px;
159159
}
160+
161+
.vant-icon__container {
162+
margin-right: 5px;
163+
}
164+
165+
&__onlyIcon {
166+
.vant-icon__container {
167+
margin-right: 0px;
168+
}
169+
}
160170
}

src/components/Button/index.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const BlockButtons = () => (
127127
);
128128

129129
export const IconButton = () => (
130-
<div className='container'>
130+
<div className='container button'>
131131
<Button icon='star-o' type='primary' />
132132
<Button icon='star-o' type='info'>
133133
Custom Icon Button

src/components/Button/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default function Button({
4646
{ square },
4747
{ block },
4848
{ hairline },
49-
{ [size]: size }
49+
{ [size]: size },
50+
{ onlyIcon: !text && !children }
5051
]),
5152
style: {}
5253
};

src/components/Field/index.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export const FieldEvents = () => {
9797
export const FieldRef = () => {
9898
const [containerRef, setContainerRef] = useState(null);
9999
const [fieldRef, setFieldRef] = useState(null);
100+
const [clickOutside, setClickOutside] = useState(false);
100101

101102
window.addEventListener('click', (e) => {
102103
if (
@@ -106,7 +107,9 @@ export const FieldRef = () => {
106107
// @ts-ignore: Object is possibly 'null'.
107108
!containerRef.current.contains(e.target)
108109
) {
109-
alert('Click outside of container detected');
110+
setClickOutside(true);
111+
} else {
112+
setClickOutside(false);
110113
}
111114
});
112115

@@ -127,6 +130,7 @@ export const FieldRef = () => {
127130
}
128131
</p>
129132
<Field
133+
placeholder={`Click outside? ${clickOutside}`}
130134
leftIcon='music-o'
131135
rightIcon='success'
132136
getContainerRef={(ref) => setContainerRef(ref)}

src/styles/stories.scss

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
body {
44
margin: 0;
5-
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
6-
Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB',
7-
'Microsoft Yahei', sans-serif;
5+
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC',
6+
'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
87
}
98

109
.container {
@@ -24,6 +23,9 @@ body {
2423
margin-bottom: 20px;
2524
margin-right: 20px;
2625
}
26+
i {
27+
margin-right: 5px;
28+
}
2729
}
2830

2931
&.column {
@@ -43,10 +45,6 @@ body {
4345
margin: 0;
4446
}
4547
}
46-
47-
.vant-button {
48-
margin-right: 20px;
49-
}
5048
}
5149

5250
.icons-container {

0 commit comments

Comments
 (0)