Skip to content

Commit 150bd00

Browse files
committed
refactor: step handler
1 parent 9ec02df commit 150bd00

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/InputNumber.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ const InternalInputNumber = React.forwardRef(
157157
...inputProps
158158
} = props;
159159

160+
const { classNames, styles } = React.useContext(SemanticContext) || {};
161+
160162
const inputClassName = `${prefixCls}-input`;
161163

162164
const inputRef = React.useRef<HTMLInputElement>(null);
@@ -629,8 +631,8 @@ const InternalInputNumber = React.forwardRef(
629631
>
630632
{type === 'input' && controls && (
631633
<div
632-
className={clsx(`${prefixCls}-handler-wrap`, props.classNames?.actions)}
633-
style={props.styles?.actions}
634+
className={clsx(`${prefixCls}-handler-wrap`, classNames?.actions)}
635+
style={styles?.actions}
634636
>
635637
{upNode}
636638
{downNode}

src/StepHandler.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import * as React from 'react';
33
import { clsx } from 'clsx';
44
import raf from '@rc-component/util/lib/raf';
5-
import SemanticContext from './SemanticContext';
65

76
/**
87
* When click and hold on a button - the speed of auto changing the value.
@@ -36,8 +35,6 @@ export default function StepHandler({
3635
const onStepRef = React.useRef<StepHandlerProps['onStep']>();
3736
onStepRef.current = onStep;
3837

39-
const { classNames, styles } = React.useContext(SemanticContext) || {};
40-
4138
const onStopStep = () => {
4239
clearTimeout(stepTimeoutRef.current);
4340
};
@@ -73,7 +70,7 @@ export default function StepHandler({
7370
// ======================= Render =======================
7471
const handlerClassName = `${prefixCls}-handler`;
7572

76-
const className = clsx(handlerClassName, `${handlerClassName}-up`, {
73+
const className = clsx(handlerClassName, `${handlerClassName}-${action}`, {
7774
[`${handlerClassName}-${action}-disabled`]: disabled,
7875
});
7976

@@ -104,10 +101,4 @@ export default function StepHandler({
104101
{children || <span unselectable="on" className={`${prefixCls}-handler-${action}-inner`} />}
105102
</span>
106103
);
107-
108-
return (
109-
<div className={clsx(`${handlerClassName}-wrap`, classNames?.actions)} style={styles?.actions}>
110-
//
111-
</div>
112-
);
113104
}

0 commit comments

Comments
 (0)