diff --git a/packages/components/src/helpers/getUserFullName.js b/packages/components/src/helpers/getUserFullName.js index 3b02dea2a..8a9bec421 100644 --- a/packages/components/src/helpers/getUserFullName.js +++ b/packages/components/src/helpers/getUserFullName.js @@ -1,9 +1,7 @@ function getUserFullName(user) { - return ( - (user.name ? user.name : '') + - (user.surnames ? ` ${user.surnames}` : '') + - (user.secondSurname ? ` ${user.secondSurname}` : '') - ); + return `${user.secondSurname ? `${user.secondSurname} ` : ''}${ + user.surnames ? user.surnames : '' + }${user.secondSurname || user.surnames ? ', ' : ''}${user.name}`; } export { getUserFullName }; diff --git a/packages/components/src/informative/UserDisplayItem/UserDisplayItem.js b/packages/components/src/informative/UserDisplayItem/UserDisplayItem.js index c7cfcab49..622c7bee5 100644 --- a/packages/components/src/informative/UserDisplayItem/UserDisplayItem.js +++ b/packages/components/src/informative/UserDisplayItem/UserDisplayItem.js @@ -84,7 +84,10 @@ const UserDisplayItem = (properties) => { const role = useMemo(() => (!isEmpty(center) ? `${rol} ยท ${center}` : rol), [rol, center]); const fullName = useMemo( - () => (['rol', 'inline'].includes(variant) ? `${surnames || ''} ${name}` : name), + () => + ['rol', 'inline'].includes(variant) + ? `${surnames || ''}${!surnames ? '' : ', '}${name}` + : name, [name, surnames, variant], );