Skip to content

Commit

Permalink
refactor(components): unified user name positions to [surname, ]<name>
Browse files Browse the repository at this point in the history
Ticket: issue/Transversal-196
Reviewed-by: @MIGUELez11
Refs: #158
  • Loading branch information
fermarinsanchez authored May 24, 2024
1 parent f8c4f91 commit b9bf541
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 3 additions & 5 deletions packages/components/src/helpers/getUserFullName.js
Original file line number Diff line number Diff line change
@@ -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 };
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);

Expand Down

0 comments on commit b9bf541

Please sign in to comment.