Skip to content

Commit

Permalink
fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
chen_gh committed Sep 6, 2024
1 parent 64d094b commit a71cbd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/past-time-picker/PastTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ const PastTimePicker = (props: PastTimePickerProps) => {
const humanizeTimeRange = (
time: string,
defaultString = timeRangeText,
quickOptions: PastTimePickerProps['quickOptions']
_quickOptions: PastTimePickerProps['quickOptions']
) => {
if (!time) {
return defaultString;
}

let op;
if ((op = quickOptions?.find((option) => option.value === time))) {
const op = _quickOptions?.find((option) => option.value === time);
if (op) {
return op.label;
}

Expand Down
4 changes: 1 addition & 3 deletions src/past-time-picker/demos/PastTimePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ Modes.args = {
};

export const DisabledDate = () => {
const disabledDate = (current: Date) => {
return differenceInDays(startOfToday(), current) > 7;
};
const disabledDate = (current: Date) => differenceInDays(startOfToday(), current) > 7;

return (
<PastTimePicker
Expand Down
4 changes: 2 additions & 2 deletions src/static-past-time-picker/StaticPastTimePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useCallback } from 'react';
import { usePrefixCls, useLocale } from '@gio-design/utils';
import { filter } from 'lodash';
import SelectList from '../list';
Expand Down Expand Up @@ -87,7 +87,7 @@ function StaticPastTimePicker({

earliestApprove && options.push({ value: 'earliest', label: earliestInHistory });

const parseMode = (current: string | undefined) => parseTimeMode(current, options);
const parseMode = useCallback((current: string | undefined) => parseTimeMode(current, options), [options]);
const originMode = parseMode(timeRange) ?? 'quick';
const [mode, setMode] = React.useState<string | undefined>(originMode);

Expand Down

0 comments on commit a71cbd3

Please sign in to comment.