From a87f06b4cb10014b431e0a3ea8d6ba1da5a02fc1 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Wed, 6 Jan 2021 15:53:48 +0530 Subject: computed attribute code improvements --- modern/src/settings/ComputedAttributePage.js | 22 ++++++++++++---------- modern/src/settings/ComputedAttributesPage.js | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'modern/src/settings') diff --git a/modern/src/settings/ComputedAttributePage.js b/modern/src/settings/ComputedAttributePage.js index f985152f..7ff9511f 100644 --- a/modern/src/settings/ComputedAttributePage.js +++ b/modern/src/settings/ComputedAttributePage.js @@ -25,6 +25,17 @@ const ComputedAttributePage =() => { type: value.type, })); + const handleChange = event => { + const newValue = event.target.value; + setKey(newValue); + const positionAttribute = positionAttributes[newValue]; + if(positionAttribute && positionAttribute.type) { + setItem({...item, attribute: newValue, type: positionAttribute.type}); + } else { + setItem({...item, attribute: newValue}); + } + } + return ( {item && @@ -45,16 +56,7 @@ const ComputedAttributePage =() => { {t('sharedAttribute')}