mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added months passed to comments
This commit is contained in:
parent
3dfd886570
commit
0286b6f1a5
4 changed files with 7 additions and 6 deletions
|
@ -59,7 +59,7 @@ const Comment: FC<IProps> = memo(
|
||||||
return (
|
return (
|
||||||
<CommentContent
|
<CommentContent
|
||||||
prefix={
|
prefix={
|
||||||
group.distancesInDays[index] > 9 && (
|
Math.abs(group.distancesInDays[index]) > 30 && (
|
||||||
<CommentDistance
|
<CommentDistance
|
||||||
firstDate={comment?.created_at ? parseISO(comment.created_at) : undefined}
|
firstDate={comment?.created_at ? parseISO(comment.created_at) : undefined}
|
||||||
secondDate={
|
secondDate={
|
||||||
|
|
|
@ -163,9 +163,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.prefix {
|
.prefix {
|
||||||
|
display: inline-flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
transform: translate(50%, -50%);
|
transform: translate(0, -50%);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,6 @@ const CommentDistance: FC<CommentDistanceProps> = memo(({ firstDate, secondDate
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (differenceInDays(secondDate, firstDate) < 30) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatDistance(secondDate, firstDate, {
|
return formatDistance(secondDate, firstDate, {
|
||||||
locale: ru,
|
locale: ru,
|
||||||
addSuffix: false,
|
addSuffix: false,
|
||||||
|
|
|
@ -9,4 +9,5 @@
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
padding: 1px 10px 3px;
|
padding: 1px 10px 3px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue