diff --git a/src/components/content/DescriptionItem/DescriptionItem.tsx b/src/components/content/DescriptionItem/DescriptionItem.tsx index 29ecdb9c..19d0e16d 100644 --- a/src/components/content/DescriptionItem/DescriptionItem.tsx +++ b/src/components/content/DescriptionItem/DescriptionItem.tsx @@ -47,15 +47,20 @@ export function DescriptionItem({ title, className, contentProps, - ...props + hideIfEmpty = false, + content, }: DescriptionItemProps) { return ( <> - {((props.hideIfEmpty && props.content) ?? !props.hideIfEmpty) && ( + {((hideIfEmpty && + content !== null && + content !== undefined && + content !== '') || + !hideIfEmpty) && ( {title} - {props.content} + {content} )} diff --git a/src/components/content/WithPlaceholder/WithPlaceholder.tsx b/src/components/content/WithPlaceholder/WithPlaceholder.tsx index 9a913dff..4cf4ee8d 100644 --- a/src/components/content/WithPlaceholder/WithPlaceholder.tsx +++ b/src/components/content/WithPlaceholder/WithPlaceholder.tsx @@ -14,14 +14,15 @@ export function WithPlaceholder({ placeholder = '-', children, }: WithPlaceholderProps) { - /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ return ( <> {typeof children === 'number' ? isNaN(children) ? placeholder : children - : children || placeholder} + : children === null || children === undefined || children === '' + ? placeholder + : children} ) } diff --git a/src/components/util/useId.ts b/src/components/util/useId.ts index 4b57d971..8338457c 100644 --- a/src/components/util/useId.ts +++ b/src/components/util/useId.ts @@ -22,6 +22,8 @@ const useIsomorphicLayoutEffect = canUseDOM() ? useLayoutEffect : useEffect function canUseDOM() { return Boolean( typeof window !== 'undefined' && + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined', ) }