Bläddra i källkod

fixed border bottom management in workspace content

Skylsmoi 6 år sedan
förälder
incheckning
77534b9809

+ 1 - 1
src/component/Workspace/FileItem.jsx Visa fil

17
   })()
17
   })()
18
 
18
 
19
   return (
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
       <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
21
       <div className='col-2 col-sm-2 col-md-2 col-lg-2 col-xl-1'>
22
         <div className='file__type'>
22
         <div className='file__type'>
23
           <i className={props.icon} />
23
           <i className={props.icon} />

+ 5 - 4
src/component/Workspace/Folder.jsx Visa fil

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

+ 3 - 2
src/container/WorkspaceContent.jsx Visa fil

62
           <div className='workspace__content__fileandfolder folder__content active'>
62
           <div className='workspace__content__fileandfolder folder__content active'>
63
             <FileItemHeader />
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
                 <FileItem
68
                 <FileItem
69
                   name={c.title}
69
                   name={c.title}
71
                   icon={(app[c.type] || {icon: ''}).icon}
71
                   icon={(app[c.type] || {icon: ''}).icon}
72
                   status={c.status}
72
                   status={c.status}
73
                   onClickItem={() => this.handleClickContentItem(c)}
73
                   onClickItem={() => this.handleClickContentItem(c)}
74
+                  isLast={i === workspace.content.length - 1}
74
                   key={c.id}
75
                   key={c.id}
75
                 />
76
                 />
76
               )
77
               )

+ 6 - 2
src/css/Folder.styl Visa fil

3
 border-style = 1px solid darkBlue
3
 border-style = 1px solid darkBlue
4
 .folder__header
4
 .folder__header
5
   border border-style
5
   border border-style
6
-.file
7
-  border border-style
8
 .folder + .file, .file + .file
6
 .folder + .file, .file + .file
9
   border-bottom 0
7
   border-bottom 0
10
 .folder__content > .file, .folder__content > .folder
8
 .folder__content > .file, .folder__content > .folder
11
   border-bottom 0
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
 // @TODO the very last line of file or folder has to be added a border bottom in js
16
 // @TODO the very last line of file or folder has to be added a border bottom in js
13
 // -----------------------------------------------------
17
 // -----------------------------------------------------
14
 
18