Skip to content

Commit 0c4c035

Browse files
committed
* pick: improve code readability by standardizing arrow function syntax and adjusting component return structure.
1 parent 8027402 commit 0c4c035

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

lib/pick/src/components/pick.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi
7272
}
7373

7474
changeState(state: Partial<S> | ((prevState: Readonly<S>) => Partial<S>), callback?: () => void): Promise<S> {
75-
return new Promise<S>(resolve => {
75+
return new Promise<S>((resolve) => {
7676
this.setState(state, () => {
7777
callback?.();
7878
resolve(this.state);
@@ -97,7 +97,7 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi
9797
this._toggleTimer = 0;
9898
}
9999

100-
let newState = await this.changeState(prevState => {
100+
let newState = await this.changeState((prevState) => {
101101
open = open ?? !prevState.open;
102102

103103
return {
@@ -179,12 +179,10 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi
179179
};
180180
}
181181

182-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
183182
protected _renderTrigger(_props: RenderableProps<O>, _state: Readonly<S>): ComponentChildren {
184183
return null;
185184
}
186185

187-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
188186
protected _renderPop(_props: RenderableProps<O>, _state: Readonly<S>): ComponentChildren {
189187
return null;
190188
}
@@ -296,15 +294,17 @@ export class Pick<S extends PickState = PickState, O extends PickOptions<S> = Pi
296294
let popView: ComponentChildren;
297295
if (opened && (!props.hidePopWhenEmpty || !this._isEmptyValue())) {
298296
const Pop = this._getPop(props);
299-
popView = (<Pop key="pop" ref={this._pop} {...this._getPopProps(props, state)}>
300-
{this._renderPop(props, state)}
301-
</Pop>);
297+
popView = (
298+
<Pop key="pop" ref={this._pop} {...this._getPopProps(props, state)}>
299+
{this._renderPop(props, state)}
300+
</Pop>
301+
);
302302
}
303-
return (<>
303+
return [
304304
<Trigger key="pick" {...this._getTriggerProps(props, state)}>
305305
{this._renderTrigger(props, state)}
306-
</Trigger>
307-
{popView}
308-
</>);
306+
</Trigger>,
307+
popView,
308+
];
309309
}
310310
}

0 commit comments

Comments
 (0)