Skip to content

Commit fac5133

Browse files
feat(annotation-thread): Annotation thread comments visual fixes (#3128)
* feat(annotation-thread): Change timestamp color * feat(annotation-thread): Add gap between timestamp and the message * feat(annotation-thread): Reduce the horizontal margin on ActivityCard * feat(annotation-thread): Extend header divider line to full width of sidebar * feat(annotation-thread): Extend threads divider line to full width of sidebar * feat(annotation-thread): Add shadow under header when feed is scrolled * feat(annotation-thread): Rename state and className * feat(annotation-thread): Throttle onScroll event * feat(annotation-thread): Extract a variable for SidebarHeader * feat(annotation-thread): Escape leading space in edited message * feat(annotation-thread): Add separator in Comment Between ActivityTimestamp and Comment/ActivityStatus * feat(annotation-thread): Extend horizontal lines only for ActivityThread * feat(annotation-thread): Use variable for bcs-content-header margin * feat(annotation-thread): Move styles, renaming classes, using variables
1 parent 5685142 commit fac5133

File tree

13 files changed

+77
-18
lines changed

13 files changed

+77
-18
lines changed

i18n/en-US.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ be.contentSidebar.activityFeed.commentForm.commentWrite = Write a comment
194194
be.contentSidebar.activityFeed.commmon.showOriginalMessage = Show Original
195195
# Indicator of resolved status of Comment or Annotation, visible in Feed Item (in upper-case in supported language)
196196
be.contentSidebar.activityFeed.common.activityStatusResolved = RESOLVED
197-
# Label indicating that message was edited, should be lowercase
198-
be.contentSidebar.activityFeed.common.editedMessage = (edited)
197+
# Label indicating that message was edited, should be lowercase, should have escaped leading space
198+
be.contentSidebar.activityFeed.common.editedMessage = \ (edited)
199199
# See less button for hiding part of long message
200200
be.contentSidebar.activityFeed.common.seeLessMessage = See less
201201
# See more button for showing whole long message

src/elements/common/_variables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
$font: Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;
55

66
$minimumWidth: 300px;
7+
$sidebarHeaderHeight: 60px;
78
$sidebarContentWidth: 340px;
8-
$sidebarActivityFeedSpacingHorizontal: 25px;
9+
$sidebarActivityFeedSpacingHorizontal: 20px;
910
$sidebarActivityFeedSpacingVertical: 20px;
1011
$sidebarTabResponsiveSize: 48px;
1112

src/elements/content-sidebar/ActivitySidebar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import * as React from 'react';
8+
import classNames from 'classnames';
89
import debounce from 'lodash/debounce';
910
import flow from 'lodash/flow';
1011
import getProp from 'lodash/get';
@@ -1207,7 +1208,7 @@ class ActivitySidebar extends React.PureComponent<Props, State> {
12071208
return (
12081209
<SidebarContent
12091210
actions={this.renderActions()}
1210-
className="bcs-activity"
1211+
className={classNames('bcs-activity', { 'bcs-activity--full': hasReplies })}
12111212
elementId={elementId}
12121213
sidebarView={SIDEBAR_VIEW_ACTIVITY}
12131214
title={this.renderTitle()}

src/elements/content-sidebar/ActivitySidebar.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@
66
height: 100%;
77
}
88
}
9+
10+
.bcs-activity--full {
11+
.bcs-content-header {
12+
margin: 0;
13+
padding: 0 $sidebarActivityFeedSpacingHorizontal;
14+
}
15+
}

src/elements/content-sidebar/SidebarContent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Props = {
1616
sidebarView: string,
1717
title?: React.Node,
1818
};
19-
const SidebarContent = ({ actions, children, className, title, elementId, sidebarView, ...rest }: Props) => {
19+
const SidebarContent = ({ actions, children, className, elementId, sidebarView, title, ...rest }: Props) => {
2020
const label = `${elementId}${elementId === '' ? '' : '_'}${sidebarView}`;
2121
const id = `${label}-content`;
2222

src/elements/content-sidebar/SidebarContent.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
display: flex;
1111
align-items: center;
1212
justify-content: space-between;
13-
height: 60px;
14-
margin: 0 25px;
13+
height: $sidebarHeaderHeight;
14+
margin: 0 $sidebarActivityFeedSpacingHorizontal;
1515
padding: 0;
1616
border-bottom: 1px solid $bdl-gray-10;
1717

@@ -26,7 +26,7 @@
2626

2727
.bcs-scroll-content-wrapper {
2828
position: absolute; // Prevents non-sidebar parts from re-painting
29-
top: 60px; // Same as title above
29+
top: $sidebarHeaderHeight; // Same as title above
3030
right: 0;
3131
bottom: 0;
3232
left: 0;

src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import * as React from 'react';
77
import getProp from 'lodash/get';
88
import noop from 'lodash/noop';
9+
import throttle from 'lodash/throttle';
910
import { FormattedMessage } from 'react-intl';
1011
import classNames from 'classnames';
1112
import ActiveState from './ActiveState';
@@ -95,10 +96,12 @@ type Props = {
9596

9697
type State = {
9798
isInputOpen: boolean,
99+
isScrolled: boolean,
98100
};
99101

100102
class ActivityFeed extends React.Component<Props, State> {
101103
state = {
104+
isScrolled: false,
102105
isInputOpen: false,
103106
};
104107

@@ -186,6 +189,16 @@ class ActivityFeed extends React.Component<Props, State> {
186189
}
187190
};
188191

192+
handleFeedScroll = (event: UIEvent): void => {
193+
const { target } = event;
194+
if (target instanceof Element) {
195+
const { scrollTop } = target;
196+
this.setState({ isScrolled: scrollTop > 0 });
197+
}
198+
};
199+
200+
throttledFeedScroll = throttle(this.handleFeedScroll, 100);
201+
189202
onKeyDown = (event: SyntheticKeyboardEvent<>): void => {
190203
const { nativeEvent } = event;
191204
nativeEvent.stopImmediatePropagation();
@@ -283,7 +296,7 @@ class ActivityFeed extends React.Component<Props, State> {
283296
onVersionHistoryClick,
284297
translations,
285298
} = this.props;
286-
const { isInputOpen } = this.state;
299+
const { isInputOpen, isScrolled } = this.state;
287300
const currentFileVersionId = getProp(file, 'file_version.id');
288301
const hasAnnotationCreatePermission = getProp(file, ['permissions', PERMISSION_CAN_CREATE_ANNOTATIONS], false);
289302
const hasCommentPermission = getProp(file, 'permissions.can_comment', false);
@@ -320,13 +333,18 @@ class ActivityFeed extends React.Component<Props, State> {
320333
const isInlineFeedItemErrorVisible = !isLoading && activeFeedEntryType && !activeFeedItem;
321334

322335
return (
323-
// eslint-disable-next-line
324-
<div className="bcs-activity-feed" data-testid="activityfeed" onKeyDown={this.onKeyDown}>
336+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
337+
<div
338+
className={classNames('bcs-activity-feed', { 'bcs-is-scrolled': isScrolled })}
339+
data-testid="activityfeed"
340+
onKeyDown={this.onKeyDown}
341+
>
325342
<div
326343
ref={ref => {
327344
this.feedContainer = ref;
328345
}}
329346
className="bcs-activity-feed-items-container"
347+
onScroll={this.throttledFeedScroll}
330348
>
331349
{isLoading && (
332350
<div className="bcs-activity-feed-loading-state">

src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
line-height: 20px;
2929
}
3030

31+
&.bcs-is-scrolled::before {
32+
position: absolute;
33+
// position it behind bcs-content-header
34+
top: -$sidebarHeaderHeight;
35+
right: $sidebarActivityFeedSpacingHorizontal;
36+
left: $sidebarActivityFeedSpacingHorizontal;
37+
height: $sidebarHeaderHeight;
38+
box-shadow: 0 $bdl-grid-unit $bdl-grid-unit * 3 $bdl-gray-10;
39+
content: ' ';
40+
}
41+
3142
.bcs-activity-feed-items-container {
3243
$container-padding: 25px;
3344
$container-transition-delay: 25ms;

src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
@import '../../../common/variables';
22

33
.bcs-ActivityThread {
4+
box-shadow: 0 1px 0 0 $bdl-gray-10;
5+
46
.bcs-ActivityThread-toggle {
57
color: $bdl-box-blue;
68

@@ -18,6 +20,14 @@
1820
padding: 0;
1921
}
2022

23+
.bcs-Comment-timestamp {
24+
margin-bottom: 16px;
25+
26+
.bcs-ActivityTimestamp {
27+
color: $bdl-gray;
28+
}
29+
}
30+
2131
.btn-plain:focus-visible {
2232
outline: auto;
2333
}

src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActivityFeed.test.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ exports[`elements/content-sidebar/ActivityFeed/activity-feed/ActivityFeed should
88
>
99
<div
1010
className="bcs-activity-feed-items-container"
11+
onScroll={[Function]}
1112
>
1213
<div
1314
className="bcs-activity-feed-loading-state"
@@ -26,6 +27,7 @@ exports[`elements/content-sidebar/ActivityFeed/activity-feed/ActivityFeed should
2627
>
2728
<div
2829
className="bcs-activity-feed-items-container"
30+
onScroll={[Function]}
2931
>
3032
<div
3133
className="bcs-activity-feed-loading-state"
@@ -44,6 +46,7 @@ exports[`elements/content-sidebar/ActivityFeed/activity-feed/ActivityFeed should
4446
>
4547
<div
4648
className="bcs-activity-feed-items-container"
49+
onScroll={[Function]}
4750
>
4851
<div
4952
className="bcs-activity-feed-loading-state"

0 commit comments

Comments
 (0)