chore(blocks-antd): Use conditional chain instead of ternary.

This commit is contained in:
Machiel 2024-07-16 13:09:39 +02:00
parent e4ec43505f
commit 0f781e7d2b

View File

@ -17,7 +17,6 @@
import React from 'react';
import { Input, Select } from 'antd';
import { blockDefaultProps } from '@lowdefy/block-utils';
// import { type } from '@lowdefy/helpers';
import regions from './regions.js';
import Label from '../Label/Label.js';
@ -76,9 +75,7 @@ function AddOnSelect({
onChange={(newVal) => {
const input = value?.input ?? '';
const region = uniqueValueOptions[newVal]?.value ?? {};
const phone_number = region?.dial_code ? `${region.dial_code}${input}` : input;
//? another implementation
// const phone_number = `${type.isObject(region) ? region.dial_code ?? '' : ''}${input}`;
const phone_number = `${region?.dial_code ?? ''}${input}`;
methods.setValue({
input,
@ -211,11 +208,7 @@ const PhoneNumberInput = ({
}
const region = value?.region ?? {};
const phone_number = region?.dial_code ? `${region.dial_code}${input}` : input;
//? another implementation
// const phone_number = `${
// type.isObject(region) ? region.dial_code ?? '' : ''
// }${input}`;
const phone_number = `${region?.dial_code ?? ''}${input}`;
methods.setValue({
input,