|
@@ -6,22 +6,31 @@ import { userPageRoot } from '@commons/util/path-utils';
|
|
|
import UserPicture from '../User/UserPicture';
|
|
import UserPicture from '../User/UserPicture';
|
|
|
|
|
|
|
|
const AuthorInfo = (props) => {
|
|
const AuthorInfo = (props) => {
|
|
|
- const { mode, user, date } = props;
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ mode, user, date, locate,
|
|
|
|
|
+ } = props;
|
|
|
|
|
|
|
|
- const infoLabel = mode === 'create'
|
|
|
|
|
|
|
+ const infoLabelForSubNav = mode === 'create'
|
|
|
? 'Created by'
|
|
? 'Created by'
|
|
|
: 'Updated by';
|
|
: 'Updated by';
|
|
|
|
|
+ const infoLabelForFooter = mode === 'create'
|
|
|
|
|
+ ? 'Last revision posted at'
|
|
|
|
|
+ : 'Created at';
|
|
|
const userLabel = user != null
|
|
const userLabel = user != null
|
|
|
? <a href={userPageRoot(user)}>{user.name}</a>
|
|
? <a href={userPageRoot(user)}>{user.name}</a>
|
|
|
: <i>Unknown</i>;
|
|
: <i>Unknown</i>;
|
|
|
|
|
|
|
|
|
|
+ if (locate === 'footer') {
|
|
|
|
|
+ return <p>{infoLabelForFooter} {date} by <UserPicture user={user} size="sm" /> {userLabel}</p>;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className="d-flex align-items-center">
|
|
<div className="d-flex align-items-center">
|
|
|
<div className="mr-2">
|
|
<div className="mr-2">
|
|
|
<UserPicture user={user} size="sm" />
|
|
<UserPicture user={user} size="sm" />
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
- <div>{infoLabel} {userLabel}</div>
|
|
|
|
|
|
|
+ <div>{infoLabelForSubNav} {userLabel}</div>
|
|
|
<div className="text-muted text-date">{date}</div>
|
|
<div className="text-muted text-date">{date}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -32,10 +41,12 @@ AuthorInfo.propTypes = {
|
|
|
date: PropTypes.string.isRequired,
|
|
date: PropTypes.string.isRequired,
|
|
|
user: PropTypes.object,
|
|
user: PropTypes.object,
|
|
|
mode: PropTypes.oneOf(['create', 'update']),
|
|
mode: PropTypes.oneOf(['create', 'update']),
|
|
|
|
|
+ locate: PropTypes.oneOf(['subnav', 'footer']),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
AuthorInfo.defaultProps = {
|
|
AuthorInfo.defaultProps = {
|
|
|
mode: 'create',
|
|
mode: 'create',
|
|
|
|
|
+ locate: 'subnav',
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|