瀏覽代碼

bugfix + PopinFixedOption now accepts childrens + added disabled btn props for PopinFixed

Skylsmoi 6 年之前
父節點
當前提交
ee19021d98

+ 1 - 0
src/component/Input/SelectStatus/SelectStatus.jsx 查看文件

@@ -17,6 +17,7 @@ export const SelectStatus = props => {
17 17
         aria-haspopup='true'
18 18
         aria-expanded='false'
19 19
         style={{color: props.selectedStatus ? props.selectedStatus.hexcolor : 'transparent'}}
20
+        disabled={props.disabled}
20 21
       >
21 22
         {props.selectedStatus ? props.selectedStatus.label : ''}
22 23
         <div className='selectStatus__dropdownbtn__icon'>

src/component/OptionComponent/EditContent.jsx → src/component/OptionComponent/ArchiveDeleteContent.jsx 查看文件

@@ -1,12 +1,13 @@
1 1
 import React from 'react'
2 2
 
3
-const EditContent = props => {
3
+const ArchiveDeleteContent = props => {
4 4
   return (
5 5
     <div className='d-flex align-items-center'>
6 6
       <button
7 7
         type='button'
8 8
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
9 9
         onClick={props.onClickArchiveBtn}
10
+        disabled={props.disabled}
10 11
       >
11 12
         <i className='fa fa-fw fa-archive' />
12 13
       </button>
@@ -14,6 +15,7 @@ const EditContent = props => {
14 15
         type='button'
15 16
         className='wsContentGeneric__option__menu__action optionicon d-none d-sm-block'
16 17
         onClick={props.onClickDeleteBtn}
18
+        disabled={props.disabled}
17 19
       >
18 20
         <i className='fa fa-fw fa-trash' />
19 21
       </button>
@@ -21,4 +23,4 @@ const EditContent = props => {
21 23
   )
22 24
 }
23 25
 
24
-export default EditContent
26
+export default ArchiveDeleteContent

+ 3 - 2
src/component/OptionComponent/NewVersionBtn.jsx 查看文件

@@ -2,13 +2,14 @@ import React from 'react'
2 2
 
3 3
 const NewVersionBtn = props => {
4 4
   return (
5
-    <div
5
+    <button
6 6
       className='wsContentGeneric__option__menu__addversion newversionbtn btn btn-outline-primary mr-auto'
7 7
       onClick={props.onClickNewVersionBtn}
8
+      disabled={props.disabled}
8 9
     >
9 10
       Nouvelle version
10 11
       <i className='fa fa-plus-circle ml-3' />
11
-    </div>
12
+    </button>
12 13
   )
13 14
 }
14 15
 

+ 3 - 2
src/component/PopinFixed/PopinFixed.styl 查看文件

@@ -57,8 +57,9 @@
57 57
       font-size 25px
58 58
       cursor pointer
59 59
     &__menu
60
-      display flex
61
-      align-items center
60
+      & > div
61
+        display flex
62
+        align-items center
62 63
       &__addversion
63 64
         display flex
64 65
         align-items center

+ 1 - 17
src/component/PopinFixed/PopinFixedOption.jsx 查看文件

@@ -3,9 +3,6 @@ import classnames from 'classnames'
3 3
 import PropTypes from 'prop-types'
4 4
 import { translate } from 'react-i18next'
5 5
 import i18n from '../../i18n.js'
6
-import NewVersionBtn from '../OptionComponent/NewVersionBtn.jsx'
7
-import EditContent from '../OptionComponent/EditContent.jsx'
8
-import SelectStatus from '../Input/SelectStatus/SelectStatus.jsx'
9 6
 
10 7
 const PopinFixedOption = props => {
11 8
   translate.setI18n(props.i18n ? props.i18n : i18n) // mandatory to allow Apps to overrides trad
@@ -13,20 +10,7 @@ const PopinFixedOption = props => {
13 10
   return (
14 11
     <div className={classnames('wsContentGeneric__option', `${props.customClass}__option`)}>
15 12
       <div className={classnames('wsContentGeneric__option__menu', `${props.customClass}__option__menu`)}>
16
-
17
-        <NewVersionBtn onClickNewVersionBtn={props.onClickNewVersionBtn} />
18
-
19
-        <SelectStatus
20
-          selectedStatus={props.selectedStatus}
21
-          availableStatus={props.availableStatus}
22
-          onChangeStatus={props.onChangeStatus}
23
-        />
24
-
25
-        <EditContent
26
-          onClickArchiveBtn={props.onClickArchive}
27
-          onClickDeleteBtn={props.onClickDelete}
28
-        />
29
-
13
+        {props.children}
30 14
       </div>
31 15
     </div>
32 16
   )

+ 6 - 2
src/component/Timeline/Revision.jsx 查看文件

@@ -3,10 +3,14 @@ import classnames from 'classnames'
3 3
 
4 4
 const Revision = props => (
5 5
   <li className={classnames(`${props.customClass}__messagelist__version`, 'timeline__messagelist__version')} >
6
-    <div className={classnames(`${props.customClass}__messagelist__version__btn`, 'timeline__messagelist__version__btn btn')}>
6
+    <button
7
+      type='button'
8
+      className={classnames(`${props.customClass}__messagelist__version__btn`, 'timeline__messagelist__version__btn btn')}
9
+      onClick={props.onClickRevision}
10
+    >
7 11
       <i className='fa fa-code-fork' />
8 12
       version {props.number}
9
-    </div>
13
+    </button>
10 14
 
11 15
     <div className={classnames(`${props.customClass}__messagelist__version__date`, 'timeline__messagelist__version__date')}>
12 16
       Créer le {props.createdAt}

+ 9 - 2
src/component/Timeline/Timeline.jsx 查看文件

@@ -48,8 +48,9 @@ class Timeline extends React.Component {
48 48
                 return <Revision
49 49
                   customClass={props.customClass}
50 50
                   createdAt={content.created}
51
-                  number={props.timelineData.filter(c => c.timelineType === 'revision' && c.revision_id <= content.revision_id).length}
51
+                  number={content.number}
52 52
                   key={`revision_${content.revision_id}`}
53
+                  onClickRevision={() => props.onClickRevisionBtn(content)}
53 54
                 />
54 55
             }
55 56
           })}
@@ -63,6 +64,7 @@ class Timeline extends React.Component {
63 64
               placeholder='Taper votre message ici'
64 65
               value={props.newComment}
65 66
               onChange={props.onChangeNewComment}
67
+              disabled={props.disableComment}
66 68
             />
67 69
           </div>
68 70
 
@@ -74,6 +76,7 @@ class Timeline extends React.Component {
74 76
                   `${props.customClass}__texteditor__advancedtext__btn timeline__texteditor__advancedtext__btn btn btn-outline-primary`
75 77
                 )}
76 78
                 onClick={props.onClickWysiwygBtn}
79
+                disabled={props.disableComment}
77 80
               >
78 81
                 {props.wysiwyg ? 'Text Simple' : 'Texte Avancé'}
79 82
               </button>
@@ -84,6 +87,7 @@ class Timeline extends React.Component {
84 87
                 type='button'
85 88
                 className={classnames(`${props.customClass}__texteditor__submit__btn`, 'timeline__texteditor__submit__btn btn')}
86 89
                 onClick={props.onClickValidateNewCommentBtn}
90
+                disabled={props.disableComment}
87 91
               >
88 92
                 Envoyer
89 93
                 <div
@@ -106,13 +110,16 @@ Timeline.propTypes = {
106 110
   newComment: PropTypes.string.isRequired,
107 111
   onChangeNewComment: PropTypes.func.isRequired,
108 112
   onClickValidateNewCommentBtn: PropTypes.func.isRequired,
113
+  disableComment: PropTypes.bool,
109 114
   customClass: PropTypes.string,
110 115
   loggedUser: PropTypes.object,
111 116
   wysiwyg: PropTypes.bool,
112
-  onClickWysiwygBtn: PropTypes.func
117
+  onClickWysiwygBtn: PropTypes.func,
118
+  onClickRevisionBtn: PropTypes.func
113 119
 }
114 120
 
115 121
 Timeline.defaultProps = {
122
+  disableComment: false,
116 123
   customClass: '',
117 124
   loggedUser: {
118 125
     id: '',

+ 8 - 0
src/index.js 查看文件

@@ -17,6 +17,10 @@ import libDelimiter from './component/Delimiter/Delimiter.jsx'
17 17
 import libCardPopup from './component/CardPopup/CardPopup.jsx'
18 18
 import libCardPopupCreateContent from './component/CardPopup/CardPopupCreateContent.jsx'
19 19
 
20
+import libNewVersionBtn from './component/OptionComponent/NewVersionBtn.jsx'
21
+import libArchiveDeleteContent from './component/OptionComponent/ArchiveDeleteContent.jsx'
22
+import libSelectStatus from './component/Input/SelectStatus/SelectStatus.jsx'
23
+
20 24
 export const langFr = fr
21 25
 export const langEn = en
22 26
 
@@ -36,3 +40,7 @@ export const Delimiter = libDelimiter
36 40
 
37 41
 export const CardPopup = libCardPopup
38 42
 export const CardPopupCreateContent = libCardPopupCreateContent
43
+
44
+export const NewVersionBtn = libNewVersionBtn
45
+export const ArchiveDeleteContent = libArchiveDeleteContent
46
+export const SelectStatus = libSelectStatus