Browse Source

about to refactor wrokspace .fileitem__rowfile border bottom

Skylsmoi 6 years ago
parent
commit
eb0649309f

+ 1 - 1
src/component/Login/LoginBtnForgotPw.jsx View File

@@ -12,7 +12,7 @@ const LoginBtnForgotPw = props => {
12 12
 
13 13
 export default LoginBtnForgotPw
14 14
 
15
-LoginBtnForgotPw.PropTypes = {
15
+LoginBtnForgotPw.propTypes = {
16 16
   customClass: PropTypes.string,
17 17
   label: PropTypes.string
18 18
 }

+ 1 - 1
src/component/Login/LoginLogo.jsx View File

@@ -10,7 +10,7 @@ const Logo = props => {
10 10
 }
11 11
 export default Logo
12 12
 
13
-Logo.PropTypes = {
13
+Logo.propTypes = {
14 14
   logoSrc: PropTypes.string.isRequired,
15 15
   customClass: PropTypes.string
16 16
 }

+ 78 - 0
src/component/Workspace/FileItem.jsx View File

@@ -0,0 +1,78 @@
1
+import React from 'react'
2
+import PropTypes from 'prop-types'
3
+import classnames from 'classnames'
4
+
5
+const FileItem = props => {
6
+  const iconType = (() => {
7
+    switch (props.type) {
8
+      case 'file':
9
+        return 'fa fa-file-text-o docandfile-color'
10
+      case 'chat':
11
+        return 'fa fa-comments talk-color'
12
+      case 'task':
13
+        return 'fa fa-list-ul task-color'
14
+    }
15
+  })()
16
+
17
+  const iconStatus = (() => {
18
+    switch (props.status) {
19
+      case 'current':
20
+        return 'fa fa-cogs current-color'
21
+      case 'validated':
22
+        return 'fa fa-check validated-color'
23
+      case 'canceled':
24
+        return 'fa fa-ban canceled-color'
25
+      case 'outdated':
26
+        return '' // @TODO
27
+    }
28
+  })()
29
+
30
+  return (
31
+    <div className={classnames('fileitem__rowfile', 'align-items-center', props.customClass)} onClick={props.onClickItem}>
32
+      <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
33
+        <div className='fileitem__rowfile__type'>
34
+          <i className={iconType} />
35
+        </div>
36
+      </div>
37
+      <div className='col-8 col-sm-8 col-md-8 col-lg-8 col-xl-10'>
38
+        <div className='fileitem__rowfile__name'>
39
+          <div className='fileitem__rowfile__name__text'>
40
+            { props.name }
41
+          </div>
42
+          <div className='fileitem__rowfile__name__icons d-none d-md-flex'>
43
+            <div className='fileitem__rowfile__name__icons__download'>
44
+              <i className='fa fa-download' />
45
+            </div>
46
+            <div className='fileitem__rowfile__name__icons__archive'>
47
+              <i className='fa fa-archive' />
48
+            </div>
49
+            <div className='fileitem__rowfile__name__icons__delete'>
50
+              <i className='fa fa-trash-o' />
51
+            </div>
52
+          </div>
53
+        </div>
54
+      </div>
55
+      <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
56
+        <div className='fileitem__rowfile__status'>
57
+          <i className={iconStatus} />
58
+        </div>
59
+      </div>
60
+    </div>
61
+  )
62
+}
63
+
64
+export default FileItem
65
+
66
+FileItem.propTypes = {
67
+  type: PropTypes.string.isRequired,
68
+  status: PropTypes.string.isRequired,
69
+  customClass: PropTypes.string,
70
+  name: PropTypes.string,
71
+  onClickItem: PropTypes.func
72
+}
73
+
74
+FileItem.defaultProps = {
75
+  name: '',
76
+  customClass: '',
77
+  onClickItem: () => {}
78
+}

+ 25 - 0
src/component/Workspace/FileItemHeader.jsx View File

@@ -0,0 +1,25 @@
1
+import React from 'react'
2
+
3
+const FileItemHeader = props => {
4
+  return (
5
+    <div className='fileitem__header'>
6
+      <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
7
+        <div className='fileitem__header__type'>
8
+          Type
9
+        </div>
10
+      </div>
11
+      <div className='col-8 col-sm-8 col-md-8 col-lg-8 col-xl-10'>
12
+        <div className='fileitem__header__name'>
13
+          Nom du document ou fichier
14
+        </div>
15
+      </div>
16
+      <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
17
+        <div className='fileitem__header__status'>
18
+          Statut
19
+        </div>
20
+      </div>
21
+    </div>
22
+  )
23
+}
24
+
25
+export default FileItemHeader

src/container/Folder.jsx → src/component/Workspace/Folder.jsx View File

@@ -1,4 +1,8 @@
1 1
 import React, { Component } from 'react'
2
+// import PropTypes from 'prop-types'
3
+// import classnames from 'classnames'
4
+
5
+// @TODO set Folder as a component, state open will come from parent container (which will come from redux)
2 6
 
3 7
 class Folder extends Component {
4 8
   constructor (props) {
@@ -10,6 +14,10 @@ class Folder extends Component {
10 14
   }
11 15
 
12 16
   handleClickToggleFolder = () => this.setState({open: !this.state.open})
17
+  handleClickNewFile = e => {
18
+    e.stopPropagation() // because we have a link inside a link (togler and newFile)
19
+    console.log('new file') // @TODO
20
+  }
13 21
 
14 22
   render () {
15 23
     return (
@@ -25,7 +33,7 @@ class Folder extends Component {
25 33
             <div className='folder__header__name__text'>
26 34
               Dossier Facture
27 35
             </div>
28
-            <div className='folder__header__name__addbtn'>
36
+            <div className='folder__header__name__addbtn' onClick={this.handleClickNewFile}>
29 37
               <div className='folder__header__name__addbtn__text btn btn-primary'>
30 38
                 créer ...
31 39
               </div>

+ 0 - 55
src/container/FileItem.jsx View File

@@ -1,55 +0,0 @@
1
-import React, { Component } from 'react'
2
-
3
-class FileItem extends Component {
4
-  render () {
5
-    const { type, status, customClass } = this.props
6
-
7
-    let faClass = ''
8
-    if (type === 'file') faClass = 'fa fa-file-text-o docandfile-color'
9
-    else if (type === 'chat') faClass = 'fa fa-comments talk-color'
10
-    else if (type === 'task') faClass = 'fa fa-list-ul task-color'
11
-
12
-    let iconStatus = ''
13
-    if (status === 'current') iconStatus = 'fa fa-cogs current-color'
14
-    else if (status === 'nouse') iconStatus = 'fa fa-ban nouse-color'
15
-    else if (status === 'check') iconStatus = 'fa fa-check check-color'
16
-
17
-    let classInFolder = ''
18
-    if (customClass === 'inFolder') classInFolder = 'inFolder'
19
-
20
-    return (
21
-      <div className={'fileitem__rowfile align-items-center ' + (classInFolder)} onClick={this.props.onClickElement}>
22
-        <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
23
-          <div className='fileitem__rowfile__type'>
24
-            <i className={faClass} />
25
-          </div>
26
-        </div>
27
-        <div className='col-8 col-sm-8 col-md-8 col-lg-8 col-xl-10'>
28
-          <div className='fileitem__rowfile__name'>
29
-            <div className='fileitem__rowfile__name__text'>
30
-              { this.props.name }
31
-            </div>
32
-            <div className='fileitem__rowfile__name__icons d-none d-md-flex'>
33
-              <div className='fileitem__rowfile__name__icons__download'>
34
-                <i className='fa fa-download' />
35
-              </div>
36
-              <div className='fileitem__rowfile__name__icons__archive'>
37
-                <i className='fa fa-archive' />
38
-              </div>
39
-              <div className='fileitem__rowfile__name__icons__delete'>
40
-                <i className='fa fa-trash-o' />
41
-              </div>
42
-            </div>
43
-          </div>
44
-        </div>
45
-        <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
46
-          <div className='fileitem__rowfile__status'>
47
-            <i className={iconStatus} />
48
-          </div>
49
-        </div>
50
-      </div>
51
-    )
52
-  }
53
-}
54
-
55
-export default FileItem

+ 0 - 27
src/container/FileItemHeader.jsx View File

@@ -1,27 +0,0 @@
1
-import React, { Component } from 'react'
2
-
3
-class FileItemHeader extends Component {
4
-  render () {
5
-    return (
6
-      <div className='fileitemheader'>
7
-        <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
8
-          <div className='fileitemheader__type'>
9
-            Type
10
-          </div>
11
-        </div>
12
-        <div className='col-8 col-sm-8 col-md-8 col-lg-8 col-xl-10'>
13
-          <div className='fileitemheader__name'>
14
-            Nom du document ou fichier
15
-          </div>
16
-        </div>
17
-        <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
18
-          <div className='fileitemheader__status'>
19
-            Statut
20
-          </div>
21
-        </div>
22
-      </div>
23
-    )
24
-  }
25
-}
26
-
27
-export default FileItemHeader

+ 14 - 12
src/container/Workspace.jsx View File

@@ -1,9 +1,8 @@
1 1
 import React from 'react'
2 2
 import { connect } from 'react-redux'
3
-import classnames from 'classnames'
4
-import Folder from './Folder.jsx'
5
-import FileItem from './FileItem.jsx'
6
-import FileItemHeader from './FileItemHeader.jsx'
3
+import Folder from '../component/Workspace/Folder.jsx'
4
+import FileItem from '../component/Workspace/FileItem.jsx'
5
+import FileItemHeader from '../component/Workspace/FileItemHeader.jsx'
7 6
 // import Chat from './Chat.jsx'
8 7
 // import PageText from './PageText.jsx'
9 8
 import PageWrapper from '../component/common/layout/PageWrapper.jsx'
@@ -35,19 +34,23 @@ class Workspace extends React.Component {
35 34
           <div className='workspace__content__fileandfolder'>
36 35
             <FileItemHeader />
37 36
 
38
-            <FileItem name='Facture 57841 - Pierre Maurice - 06/06/2017' type='file' status='current' />
39 37
             <FileItem
38
+              name='Facture 57841 - Pierre Maurice - 06/06/2017'
40 39
               type='file'
40
+              status='current'
41
+              onClickItem={() => this.setState({activeFileType: 'file'})}
42
+            />
43
+            <FileItem
41 44
               name='Facture 57840 - Jean-michel Chevalier - 04/09/2017'
42
-              status='check'
43
-              onClickElement={() => this.setState({activeFileType: 'file'})}
45
+              type='file'
46
+              status='validated'
47
+              onClickItem={() => this.setState({activeFileType: 'file'})}
44 48
             />
45 49
             <FileItem
46
-              type='chat'
47 50
               name='Discussions à propos du nouveau système de facturation'
48
-              status='nouse'
49
-              customClass='inFolder'
50
-              onClickElement={() => this.setState({activeFileType: 'chat'})}
51
+              type='chat'
52
+              status='canceled'
53
+              onClickItem={() => this.setState({activeFileType: 'chat'})}
51 54
             />
52 55
 
53 56
             <Folder>
@@ -66,7 +69,6 @@ class Workspace extends React.Component {
66 69
                 <FileItem type='chat' name='Discussions à propos du nouveau système de facturation' status='nouse' customClass='inFolder' />
67 70
                 <FileItem type='file' name='Facture 57537 - Claudia Martin - 14/08/2017' status='check' customClass='inFolder' />
68 71
               </Folder>
69
-              <FileItem type='file' name='Facture 57840 - Jean-michel Chevalier - 04/09/2017' status='check' customClass='inFolder' />
70 72
             </Folder>
71 73
           </div>
72 74
 

+ 2 - 4
src/css/FileItemHeader.styl View File

@@ -1,15 +1,13 @@
1
-.fileitemheader
1
+.fileitem__header
2 2
   display flex
3
+  font-size 17px
3 4
   &__type
4 5
     padding 15px 0
5 6
     text-align center
6
-    font-size 17px
7 7
   &__name
8 8
     padding 15px 5px
9 9
     width 100%
10
-    font-size 17px
11 10
   &__status
12 11
     padding 15px 0
13 12
     width 100%
14 13
     text-align center
15
-    font-size 17px

+ 3 - 17
src/css/Folder.styl View File

@@ -1,31 +1,21 @@
1
-/****** FOLDER CLOSE *******/
2
-
3 1
 folderclose()
4 2
   height 0
5 3
   visibility hidden
6 4
   opacity 0
7 5
   border 0
8 6
 
9
-/*****************************/
10
-
11
-/****** FOLDER OPEN *******/
12
-
13 7
 folderopen()
14 8
   height 100%
15 9
   opacity 1
16 10
   visibility visible
17 11
   transition opacity 1s
18 12
 
19
-/*****************************/
20
-
21 13
 .folder
22 14
   padding-left 30px
23 15
   &:last-child
24 16
     border-bottom 1px solid dark-blue
25 17
   & > .inFolder
26 18
     folderclose()
27
-    &:last-child
28
-      border-bottom 0
29 19
   & > .folder
30 20
     folderclose()
31 21
   &.active
@@ -40,6 +30,7 @@ folderopen()
40 30
         display block
41 31
         &__triangle
42 32
           display block
33
+
43 34
   &__header
44 35
     position relative
45 36
     display flex
@@ -50,9 +41,9 @@ folderopen()
50 41
     background-color light-grey
51 42
     cursor pointer
52 43
     &:hover
53
-      background-color hover
44
+      background-color hover-folder
54 45
       .folder__header__triangleborder__triangle
55
-        border-color hover transparent transparent transparent
46
+        border-color hover-folder transparent transparent transparent
56 47
     &__triangleborder
57 48
       display none
58 49
       position absolute
@@ -104,12 +95,7 @@ folderopen()
104 95
         & > i
105 96
           margin-right 15px
106 97
 
107
-/*****************************/
108
-
109
-/**** MEDIA 575px ****/
110
-
111 98
 @media (max-width: max-xs)
112
-
113 99
   .folder
114 100
     &__header
115 101
       &__triangleborder

+ 1 - 1
src/css/Sidebar.styl View File

@@ -32,7 +32,7 @@ sidebar-width = 300px
32 32
     vertical-align top
33 33
 
34 34
 .sidebar
35
-  padding-top 87px
35
+  padding-top 85px
36 36
   &__btnnewworkspace
37 37
     margin-top 40px
38 38
     padding 10px

+ 3 - 3
src/css/Variable.styl View File

@@ -7,7 +7,7 @@ light-blue = #569EDE // #569EDE light-blue
7 7
 opacity-blue = #82B2CC // #82B2CC  blue with light opacity
8 8
 off-white = #FDFDFD // #FDFDFD off-white
9 9
 dark-grey = #252525 // #252525 dark-grey
10
-hover = #9BC1EB // #9BC1EB hover on folder
10
+hover-folder = #9BC1EB // #9BC1EB hover on folder
11 11
 hover-files = rgba(155,193,235,0.2) // hover on files
12 12
 grey = #ABABAB // #ABABAB grey
13 13
 light-grey = #f0f0f0 // #f0f0f0 light grey
@@ -55,7 +55,7 @@ min-xl = 1200px
55 55
   color red
56 56
 .current-color
57 57
   color blue
58
-.nouse-color
58
+.canceled-color
59 59
   color dark-grey
60
-.check-color
60
+.validated-color
61 61
   color green

BIN
src/img/imgProfil.png View File


BIN
src/img/imgProfil_orange.png View File


BIN
src/img/imgProfil_reverse.png View File