mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-55333] Convert ./components/post_view/floating_timestamp/floating_timestamp.tsx
from Class Component to Function Component (#25401)
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
5dea20dd3e
commit
b5bbe278eb
@ -17,35 +17,33 @@ type Props = {
|
|||||||
isRhsPost?: boolean;
|
isRhsPost?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class FloatingTimestamp extends React.PureComponent<Props> {
|
const FloatingTimestamp = ({createAt, isScrolling, isRhsPost, toastPresent}: Props) => {
|
||||||
render() {
|
if (createAt === 0) {
|
||||||
const {createAt, isScrolling, isRhsPost, toastPresent} = this.props;
|
return null;
|
||||||
|
|
||||||
if (createAt === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const classes = classNames('post-list__timestamp', {
|
|
||||||
scrolling: isScrolling,
|
|
||||||
rhs: isRhsPost,
|
|
||||||
toastAdjustment: toastPresent,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={classes}
|
|
||||||
data-testid='floatingTimestamp'
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<span>
|
|
||||||
<Timestamp
|
|
||||||
value={createAt}
|
|
||||||
useTime={false}
|
|
||||||
ranges={DATE_RANGES}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
const classes = classNames('post-list__timestamp', {
|
||||||
|
scrolling: isScrolling,
|
||||||
|
rhs: isRhsPost,
|
||||||
|
toastAdjustment: toastPresent,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classes}
|
||||||
|
data-testid='floatingTimestamp'
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
<Timestamp
|
||||||
|
value={createAt}
|
||||||
|
useTime={false}
|
||||||
|
ranges={DATE_RANGES}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default React.memo(FloatingTimestamp);
|
||||||
|
Loading…
Reference in New Issue
Block a user