diff --git a/package.json b/package.json index 8b6ee4b..1445c86 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "prepare": "husky" }, "dependencies": { - "@rc-component/util": "^1.11.1", + "@rc-component/util": "^1.13.0", "clsx": "^2.1.1" }, "devDependencies": { diff --git a/src/Step.tsx b/src/Step.tsx index 098db38..9f29512 100644 --- a/src/Step.tsx +++ b/src/Step.tsx @@ -1,5 +1,6 @@ /* eslint react/prop-types: 0 */ import * as React from 'react'; +import { isNonNullable } from '@rc-component/util'; import { clsx } from 'clsx'; import type { Status, StepItem, StepsProps } from './Steps'; import Rail from './Rail'; @@ -7,10 +8,6 @@ import { UnstableContext } from './UnstableContext'; import StepIcon, { StepIconSemanticContext } from './StepIcon'; import { StepsContext } from './Context'; -function hasContent(value: T) { - return value !== undefined && value !== null; -} - export interface StepProps { // style prefixCls?: string; @@ -122,8 +119,8 @@ export default function Step(props: StepProps) { // ========================= Render ========================= const mergedStatus = status || 'wait'; - const hasTitle = hasContent(title); - const hasSubTitle = hasContent(subTitle); + const hasTitle = isNonNullable(title); + const hasSubTitle = isNonNullable(subTitle); const classString = clsx( itemCls, @@ -203,7 +200,7 @@ export default function Step(props: StepProps) { /> )} - {hasContent(mergedContent) && ( + {isNonNullable(mergedContent) && (