Skip to content

Commit b64b303

Browse files
committed
fix all
1 parent 96e1e8b commit b64b303

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

src/components/Stepper/index.scss

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $baseClass: 'vant-stepper';
1818
display: flex;
1919
justify-content: center;
2020
align-items: center;
21+
img{
22+
width: 12px;
23+
height: auto;
24+
}
2125
input {
2226
margin: 0px 2px;
2327
border-radius: 5px;

src/components/Stepper/index.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const RangeStepper = () => (
3333

3434
export const SizeStepper = () => (
3535
<div className='container stepper'>
36-
<Stepper size={70} />
36+
<Stepper size={50} />
3737
</div>
3838
);
3939

src/components/Stepper/index.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default function Stepper({
3838
const [isInput, setIsInput] = useState(false);
3939
const animationDiv = document.getElementById('loading');
4040
const animationBackground = document.getElementById('loading-background');
41+
const [minusBt, setMinusBt] = useState({});
4142

4243
const handleIncrementBtProps = {
4344
className: classnames(baseClass, [{ disabled }, { theme }]),
@@ -133,6 +134,14 @@ export default function Stepper({
133134
}
134135
}
135136
}, [disabled, value, max, min, handleDecrementProps, handleIncrementBtProps]);
137+
useEffect(() => {
138+
if (value === 0) {
139+
const btStyle = { cursor: 'not-allowed' };
140+
setMinusBt(btStyle);
141+
} else {
142+
setMinusBt({});
143+
}
144+
}, [value]);
136145

137146
if (disabled) {
138147
Object.assign(handleDecrementProps, { disabled });
@@ -201,8 +210,12 @@ export default function Stepper({
201210
onClick={handleDecrement}
202211
{...handleDecrementProps}
203212
disabled={isMinus}
213+
style={minusBt}
204214
>
205-
<p>-</p>
215+
<img
216+
src='https://res.cloudinary.com/dlapk94rx/image/upload/v1595307854/icons8-minus-24_y8dnmc.png'
217+
alt=''
218+
/>{' '}
206219
</button>
207220
<input
208221
value={value}
@@ -216,7 +229,10 @@ export default function Stepper({
216229
{...handleIncrementBtProps}
217230
disabled={isPlus}
218231
>
219-
<p>+</p>
232+
<img
233+
src='https://res.cloudinary.com/dlapk94rx/image/upload/v1595307854/icons8-plus-24_wnv2uo.png'
234+
alt=''
235+
/>
220236
</button>
221237
{loading && (
222238
<div id='loading-background' className='load'>

0 commit comments

Comments
 (0)