Browse Source

added parameter for shouldScrollToBottom + fixed typo

Skylsmoi 5 years ago
parent
commit
f5fc5abd0d
2 changed files with 6 additions and 4 deletions
  1. 1 1
      src/component/Timeline/Revision.jsx
  2. 5 3
      src/component/Timeline/Timeline.jsx

+ 1 - 1
src/component/Timeline/Revision.jsx View File

@@ -13,7 +13,7 @@ const Revision = props => (
13 13
     </button>
14 14
 
15 15
     <div className={classnames(`${props.customClass}__messagelist__version__date`, 'timeline__messagelist__version__date')}>
16
-      Créer le {props.createdAt}
16
+      Créé le {props.createdAt}
17 17
     </div>
18 18
   </li>
19 19
 )

+ 5 - 3
src/component/Timeline/Timeline.jsx View File

@@ -12,7 +12,7 @@ class Timeline extends React.Component {
12 12
   }
13 13
 
14 14
   componentDidUpdate () {
15
-    this.scrollToBottom()
15
+    this.props.shouldScrollToBottom && this.scrollToBottom()
16 16
   }
17 17
 
18 18
   scrollToBottom = () => this.timelineBottom.scrollIntoView({behavior: 'instant'})
@@ -115,7 +115,8 @@ Timeline.propTypes = {
115 115
   loggedUser: PropTypes.object,
116 116
   wysiwyg: PropTypes.bool,
117 117
   onClickWysiwygBtn: PropTypes.func,
118
-  onClickRevisionBtn: PropTypes.func
118
+  onClickRevisionBtn: PropTypes.func,
119
+  shouldScrollToBottom: PropTypes.bool
119 120
 }
120 121
 
121 122
 Timeline.defaultProps = {
@@ -128,5 +129,6 @@ Timeline.defaultProps = {
128 129
   },
129 130
   timelineData: [],
130 131
   wysiwyg: false,
131
-  onClickWysiwygBtn: () => {}
132
+  onClickWysiwygBtn: () => {},
133
+  shouldScrollToBottom: true
132 134
 }