framework/js/lib/helpers/username.js

13 lines
409 B
JavaScript
Raw Normal View History

/**
* The `username` helper displays a user's username in a <span class="username">
* tag. If the user doesn't exist, the username will be displayed as [deleted].
*
* @param {User} user
* @return {Object}
*/
2015-04-25 20:58:39 +08:00
export default function username(user) {
const name = (user && user.username()) || app.translator.trans('core.lib.username.deleted_text');
2015-04-25 20:58:39 +08:00
return <span className="username">{name}</span>;
2015-04-25 20:58:39 +08:00
}