Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { ButtonPosition, ButtonProps } from './Button';
|
||||
|
||||
@ -41,15 +41,15 @@ export const ButtonGroup = ({
|
||||
|
||||
const additionalProps: any = { position, variant, accent, size };
|
||||
|
||||
if (isNonNullable(variant)) {
|
||||
if (isDefined(variant)) {
|
||||
additionalProps.variant = variant;
|
||||
}
|
||||
|
||||
if (isNonNullable(accent)) {
|
||||
if (isDefined(accent)) {
|
||||
additionalProps.variant = variant;
|
||||
}
|
||||
|
||||
if (isNonNullable(size)) {
|
||||
if (isDefined(size)) {
|
||||
additionalProps.size = size;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { FloatingButtonPosition, FloatingButtonProps } from './FloatingButton';
|
||||
|
||||
@ -42,7 +42,7 @@ export const FloatingButtonGroup = ({
|
||||
applyBlur: false,
|
||||
};
|
||||
|
||||
if (isNonNullable(size)) {
|
||||
if (isDefined(size)) {
|
||||
additionalProps.size = size;
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
IconX,
|
||||
} from '@/ui/display/icon';
|
||||
import { Button } from '@/ui/input/button/components/Button';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
@ -133,10 +133,7 @@ export const ImageInput = ({
|
||||
ref={hiddenFileInput}
|
||||
accept="image/jpeg, image/png, image/gif" // to desired specification
|
||||
onChange={(event) => {
|
||||
if (
|
||||
isNonNullable(onUpload) &&
|
||||
isNonNullable(event.target.files)
|
||||
) {
|
||||
if (isDefined(onUpload) && isDefined(event.target.files)) {
|
||||
onUpload(event.target.files[0]);
|
||||
}
|
||||
}}
|
||||
|
||||
@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export type ToggleSize = 'small' | 'medium';
|
||||
|
||||
@ -58,7 +58,7 @@ export const Toggle = ({
|
||||
const handleChange = () => {
|
||||
setIsOn(!isOn);
|
||||
|
||||
if (isNonNullable(onChange)) {
|
||||
if (isDefined(onChange)) {
|
||||
onChange(!isOn);
|
||||
}
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@ import { CurrencyCode } from '@/object-record/record-field/types/CurrencyCode';
|
||||
import { IconChevronDown } from '@/ui/display/icon';
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { CurrencyPickerHotkeyScope } from '../types/CurrencyPickerHotkeyScope';
|
||||
|
||||
@ -77,7 +77,7 @@ export const CurrencyPickerDropdownButton = ({
|
||||
|
||||
useEffect(() => {
|
||||
const currency = currencies.find(({ value }) => value === valueCode);
|
||||
if (isNonNullable(currency)) {
|
||||
if (isDefined(currency)) {
|
||||
setSelectedCurrency(currency);
|
||||
}
|
||||
}, [valueCode, currencies]);
|
||||
|
||||
@ -9,7 +9,7 @@ import { CountryCallingCode } from 'libphonenumber-js';
|
||||
import { IconChevronDown, IconWorld } from '@/ui/display/icon';
|
||||
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { CountryPickerHotkeyScope } from '../types/CountryPickerHotkeyScope';
|
||||
|
||||
@ -113,7 +113,7 @@ export const CountryPickerDropdownButton = ({
|
||||
|
||||
useEffect(() => {
|
||||
const country = countries.find(({ countryCode }) => countryCode === value);
|
||||
if (isNonNullable(country)) {
|
||||
if (isDefined(country)) {
|
||||
setSelectedCountry(country);
|
||||
}
|
||||
}, [countries, value]);
|
||||
|
||||
Reference in New Issue
Block a user