Browse Source

fixed border bottom management in workspace content

Skylsmoi 6 years ago
parent
commit
77534b9809

+ 1 - 1
src/component/Workspace/FileItem.jsx View File

@@ -17,7 +17,7 @@ const FileItem = props => {
17 17
   })()
18 18
 
19 19
   return (
20
-    <div className={classnames('file', 'align-items-center', props.customClass)} onClick={props.onClickItem}>
20
+    <div className={classnames('file', 'align-items-center', {'item-last': props.isLast}, props.customClass)} onClick={props.onClickItem}>
21 21
       <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
22 22
         <div className='file__type'>
23 23
           <i className={props.icon} />

+ 5 - 4
src/component/Workspace/Folder.jsx View File

@@ -21,9 +21,9 @@ class Folder extends Component {
21 21
   }
22 22
 
23 23
   render () {
24
-    const { app, folderData: { title, content } } = this.props
24
+    const { app, folderData: { title, content }, isLast } = this.props
25 25
     return (
26
-      <div className={classnames('folder', {'active': this.state.open})}>
26
+      <div className={classnames('folder', {'active': this.state.open, 'item-last': isLast})}>
27 27
         <div className='folder__header' onClick={this.handleClickToggleFolder}>
28 28
           <div className='folder__header__triangleborder'>
29 29
             <div className='folder__header__triangleborder__triangle' />
@@ -54,14 +54,15 @@ class Folder extends Component {
54 54
         </div>
55 55
 
56 56
         <div className='folder__content'>
57
-          { content.map(c => c.type === 'folder'
58
-            ? <Folder folderData={c} key={c.id} />
57
+          { content.map((c, i) => c.type === 'folder'
58
+            ? <Folder folderData={c} key={c.id} isLast={i === content.length - 1} />
59 59
             : <FileItem
60 60
               icon={(app[c.type] || {icon: ''}).icon}
61 61
               name={c.title}
62 62
               type={c.type}
63 63
               status={c.status}
64 64
               onClickItem={() => {}}
65
+              isLast={i === content.length - 1}
65 66
               key={c.id}
66 67
             />
67 68
           )}

+ 3 - 2
src/container/WorkspaceContent.jsx View File

@@ -62,8 +62,8 @@ class WorkspaceContent extends React.Component {
62 62
           <div className='workspace__content__fileandfolder folder__content active'>
63 63
             <FileItemHeader />
64 64
 
65
-            { workspace.content.map(c => c.type === 'folder'
66
-              ? <Folder app={app} folderData={c} key={c.id} />
65
+            { workspace.content.map((c, i) => c.type === 'folder'
66
+              ? <Folder app={app} folderData={c} key={c.id} isLast={i === workspace.content.length - 1} />
67 67
               : (
68 68
                 <FileItem
69 69
                   name={c.title}
@@ -71,6 +71,7 @@ class WorkspaceContent extends React.Component {
71 71
                   icon={(app[c.type] || {icon: ''}).icon}
72 72
                   status={c.status}
73 73
                   onClickItem={() => this.handleClickContentItem(c)}
74
+                  isLast={i === workspace.content.length - 1}
74 75
                   key={c.id}
75 76
                 />
76 77
               )

+ 6 - 2
src/css/Folder.styl View File

@@ -3,12 +3,16 @@
3 3
 border-style = 1px solid darkBlue
4 4
 .folder__header
5 5
   border border-style
6
-.file
7
-  border border-style
8 6
 .folder + .file, .file + .file
9 7
   border-bottom 0
10 8
 .folder__content > .file, .folder__content > .folder
11 9
   border-bottom 0
10
+.folder:not(.active).item-last
11
+  border-bottom border-style
12
+.file
13
+  border border-style
14
+  &.item-last
15
+    border-bottom border-style
12 16
 // @TODO the very last line of file or folder has to be added a border bottom in js
13 17
 // -----------------------------------------------------
14 18