Browse Source

fixed sidebar animation

Skylsmoi 7 years ago
parent
commit
cc9d3e26ba

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

31
           </div>
31
           </div>
32
           <div className='folder__header__name'>
32
           <div className='folder__header__name'>
33
             <div className='folder__header__name__icon'>
33
             <div className='folder__header__name__icon'>
34
-              <i className='fa fa-folder-open-o' />
34
+              <i className={classnames('fa', {'fa-folder-open-o': this.state.open, 'fa-folder-o': !this.state.open})} />
35
             </div>
35
             </div>
36
             <div className='folder__header__name__text'>
36
             <div className='folder__header__name__text'>
37
               { title }
37
               { title }

+ 1 - 0
src/container/Account.jsx View File

46
 
46
 
47
   componentDidUpdate () {
47
   componentDidUpdate () {
48
     const { user, workspaceList, dispatch } = this.props
48
     const { user, workspaceList, dispatch } = this.props
49
+
49
     if (user.id !== -1 && workspaceList.length > 0 && workspaceList.some(ws => ws.role === undefined)) dispatch(getUserRole(user))
50
     if (user.id !== -1 && workspaceList.length > 0 && workspaceList.some(ws => ws.role === undefined)) dispatch(getUserRole(user))
50
   }
51
   }
51
 
52
 

+ 4 - 1
src/container/Sidebar.jsx View File

16
     super(props)
16
     super(props)
17
     this.state = {
17
     this.state = {
18
       sidebarClose: false,
18
       sidebarClose: false,
19
-      workspaceIdInUrl: parseInt(props.match.params.idws)
19
+      workspaceIdInUrl: props.match.params.idws ? parseInt(props.match.params.idws) : null
20
     }
20
     }
21
   }
21
   }
22
 
22
 
23
   componentDidMount () {
23
   componentDidMount () {
24
     const { workspaceIdInUrl } = this.state
24
     const { workspaceIdInUrl } = this.state
25
     const { user, workspaceList, dispatch } = this.props
25
     const { user, workspaceList, dispatch } = this.props
26
+
26
     user.id !== -1 && workspaceList.length === 0 && dispatch(getWorkspaceList(user.id, workspaceIdInUrl))
27
     user.id !== -1 && workspaceList.length === 0 && dispatch(getWorkspaceList(user.id, workspaceIdInUrl))
27
   }
28
   }
28
 
29
 
29
   componentDidUpdate (prevProps, prevState) {
30
   componentDidUpdate (prevProps, prevState) {
30
     const { user, match, dispatch } = this.props
31
     const { user, match, dispatch } = this.props
31
 
32
 
33
+    if (this.state.workspaceIdInUrl === null) return
34
+
32
     const newWorkspaceId = parseInt(match.params.idws)
35
     const newWorkspaceId = parseInt(match.params.idws)
33
     prevState.workspaceIdInUrl !== newWorkspaceId && this.setState({workspaceIdInUrl: newWorkspaceId})
36
     prevState.workspaceIdInUrl !== newWorkspaceId && this.setState({workspaceIdInUrl: newWorkspaceId})
34
 
37
 

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

13
   border border-style
13
   border border-style
14
   &.item-last
14
   &.item-last
15
     border-bottom border-style
15
     border-bottom border-style
16
-// @TODO the very last line of file or folder has to be added a border bottom in js
16
+// @Info: the very last line of file or folder has it's border bottom added in js
17
 // -----------------------------------------------------
17
 // -----------------------------------------------------
18
 
18
 
19
 folderclose()
19
 folderclose()
25
   height 100%
25
   height 100%
26
   opacity 1
26
   opacity 1
27
   visibility visible
27
   visibility visible
28
-  transition opacity 1s
28
+  transition opacity 0.3s
29
 
29
 
30
 .folder
30
 .folder
31
   padding-left 30px
31
   padding-left 30px

+ 9 - 10
src/css/Sidebar.styl View File

20
   z-index 1
20
   z-index 1
21
 
21
 
22
 sidebar-width = 300px
22
 sidebar-width = 300px
23
+sidebar-animate-speed = 0.5s
23
 
24
 
24
 leftside()
25
 leftside()
25
   flex-grow 0
26
   flex-grow 0
29
 
30
 
30
 .sidebar
31
 .sidebar
31
   position relative
32
   position relative
32
-  transition all 0.5s
33
-  width 300px
33
+  transition all sidebar-animate-speed
34
+  width sidebar-width
34
   &.sidebarclose
35
   &.sidebarclose
35
     width 0
36
     width 0
36
-    transform translateX("-%s" % sidebar-width)
37
     .sidebar__expand
37
     .sidebar__expand
38
-      right "calc(-%s - 39px)" % sidebar-width
38
+      border-bottom-right-radius 0
39
   &__expand
39
   &__expand
40
     position absolute
40
     position absolute
41
-    top 0
41
+    top -1px
42
     right -39px
42
     right -39px
43
     padding 5px 8px
43
     padding 5px 8px
44
     border 1px solid white
44
     border 1px solid white
46
     cursor pointer
46
     cursor pointer
47
     background-color blue
47
     background-color blue
48
     color white
48
     color white
49
-    transition all 0.5s
49
+    transition all sidebar-animate-speed
50
   &__btnnewworkspace
50
   &__btnnewworkspace
51
-    margin-top 40px
52
-    padding 10px
53
-    width 100%
51
+    margin-top 50px
52
+    overflow hidden
54
     &__btn
53
     &__btn
55
       display block
54
       display block
56
       margin 0 auto
55
       margin 0 auto
57
       padding 15px 30px
56
       padding 15px 30px
58
   &__navigation
57
   &__navigation
59
     padding 0
58
     padding 0
59
+    overflow hidden
60
     &__workspace
60
     &__workspace
61
       padding-left 0
61
       padding-left 0
62
       list-style none
62
       list-style none
63
       &__item
63
       &__item
64
-        width sidebar-width
65
         &__wrapper
64
         &__wrapper
66
           display flex
65
           display flex
67
           align-items center
66
           align-items center