Browse Source

Fix the width and fix the scroll on the responsive mode of the sidebar

AlexiCauvin 6 years ago
parent
commit
fa53d0961f

+ 8 - 8
frontend/src/component/Sidebar/WorkspaceListItem.jsx View File

@@ -7,27 +7,27 @@ import { Link } from 'react-router-dom'
7 7
 
8 8
 const WorkspaceListItem = props => {
9 9
   return (
10
-    <li className='sidebar__navigation__workspace__item'>
10
+    <li className='sidebar__content__navigation__workspace__item'>
11 11
       <div
12
-        className='sidebar__navigation__workspace__item__wrapper primaryColorBg primaryColorBgDarkenHover primaryColorBorder'
12
+        className='sidebar__content__navigation__workspace__item__wrapper primaryColorBg primaryColorBgDarkenHover primaryColorBorder'
13 13
         onClick={props.onClickTitle}
14 14
       >
15
-        <div className='sidebar__navigation__workspace__item__number'>
15
+        <div className='sidebar__content__navigation__workspace__item__number'>
16 16
           {props.label.substring(0, 2).toUpperCase()}
17 17
         </div>
18 18
 
19
-        <div className='sidebar__navigation__workspace__item__name' title={props.label}>
19
+        <div className='sidebar__content__navigation__workspace__item__name' title={props.label}>
20 20
           {props.label}
21 21
         </div>
22 22
 
23
-        <div className='sidebar__navigation__workspace__item__icon'>
23
+        <div className='sidebar__content__navigation__workspace__item__icon'>
24 24
           <i className={classnames(props.isOpenInSidebar ? 'fa fa-chevron-up' : 'fa fa-chevron-down')} />
25 25
         </div>
26 26
       </div>
27 27
 
28 28
       <AnimateHeight duration={500} height={props.isOpenInSidebar ? 'auto' : 0}>
29 29
         <ul
30
-          className='sidebar__navigation__workspace__item__submenu'
30
+          className='sidebar__content__navigation__workspace__item__submenu'
31 31
           id={`sidebarSubMenu_${props.number}`}
32 32
         >
33 33
           { props.allowedApp.map(aa =>
@@ -37,14 +37,14 @@ const WorkspaceListItem = props => {
37 37
             >
38 38
               <Link to={aa.route}>
39 39
                 <div className={classnames(
40
-                  'sidebar__navigation__workspace__item__submenu__dropdown primaryColorBgLighten primaryColorBgHover primaryColorBorderDarken',
40
+                  'sidebar__content__navigation__workspace__item__submenu__dropdown primaryColorBgLighten primaryColorBgHover primaryColorBorderDarken',
41 41
                   {'activeFilter': props.activeFilterList.includes(aa.slug)}
42 42
                 )}>
43 43
                   <div className='dropdown__icon'>
44 44
                     <i className={classnames(`fa fa-${aa.faIcon}`)} style={{backgroudColor: aa.hexcolor}} />
45 45
                   </div>
46 46
 
47
-                  <div className='sidebar__navigation__workspace__item__submenu__dropdown__showdropdown'>
47
+                  <div className='sidebar__content__navigation__workspace__item__submenu__dropdown__showdropdown'>
48 48
                     <div className='dropdown__title' id='navbarDropdown'>
49 49
                       <div className='dropdown__title__text'>
50 50
                         {aa.label/* [props.lang.id] */}

+ 37 - 39
frontend/src/container/Sidebar.jsx View File

@@ -106,49 +106,47 @@ class Sidebar extends React.Component {
106 106
 
107 107
     return (
108 108
       <div className={classnames('sidebar primaryColorBgDarken', {'sidebarclose': sidebarClose})}>
109
-        <div className='sidebarSticky'>
110
-          <div className='sidebar__expand primaryColorBg' onClick={this.handleClickToggleSidebar}>
111
-            <i className={classnames('fa fa-chevron-left', {'fa-chevron-right': sidebarClose, 'fa-chevron-left': !sidebarClose})} />
112
-          </div>
113 109
 
114
-          <div className='sidebar__content'>
115
-
116
-            <nav className='sidebar__navigation'>
117
-              <ul className='sidebar__navigation__workspace'>
118
-                { workspaceList.map(ws =>
119
-                  <WorkspaceListItem
120
-                    idWs={ws.id}
121
-                    label={ws.label}
122
-                    allowedApp={ws.sidebarEntry}
123
-                    lang={activeLang}
124
-                    activeFilterList={ws.id === workspaceIdInUrl ? [qs.parse(this.props.location.search).type] : []}
125
-                    isOpenInSidebar={ws.isOpenInSidebar}
126
-                    onClickTitle={() => this.handleClickWorkspace(ws.id, !ws.isOpenInSidebar)}
127
-                    onClickAllContent={this.handleClickAllContent}
128
-                    // onClickContentFilter={this.handleClickContentFilter}
129
-                    key={ws.id}
130
-                  />
131
-                )}
132
-              </ul>
133
-            </nav>
134
-
135
-            <div className='sidebar__btnnewworkspace'>
136
-              <button
137
-                className='sidebar__btnnewworkspace__btn btn btn-primary primaryColorBg primaryColorBorder primaryColorBorderDarkenHover mb-5'
138
-                onClick={this.handleClickNewWorkspace}
139
-              >
140
-                {t('Create a workspace')}
141
-              </button>
142
-            </div>
110
+        <div className='sidebar__expand primaryColorBg' onClick={this.handleClickToggleSidebar}>
111
+          <i className={classnames('fa fa-chevron-left', {'fa-chevron-right': sidebarClose, 'fa-chevron-left': !sidebarClose})} />
112
+        </div>
143 113
 
114
+        <div className='sidebar__content'>
115
+          <nav className={classnames('sidebar__content__navigation', {'sidebarclose': sidebarClose})}>
116
+            <ul className='sidebar__content__navigation__workspace'>
117
+              { workspaceList.map(ws =>
118
+                <WorkspaceListItem
119
+                  idWs={ws.id}
120
+                  label={ws.label}
121
+                  allowedApp={ws.sidebarEntry}
122
+                  lang={activeLang}
123
+                  activeFilterList={ws.id === workspaceIdInUrl ? [qs.parse(this.props.location.search).type] : []}
124
+                  isOpenInSidebar={ws.isOpenInSidebar}
125
+                  onClickTitle={() => this.handleClickWorkspace(ws.id, !ws.isOpenInSidebar)}
126
+                  onClickAllContent={this.handleClickAllContent}
127
+                  // onClickContentFilter={this.handleClickContentFilter}
128
+                  key={ws.id}
129
+                />
130
+              )}
131
+            </ul>
132
+          </nav>
133
+
134
+          <div className='sidebar__content__btnnewworkspace'>
135
+            <button
136
+              className='sidebar__content__btnnewworkspace__btn btn btn-primary primaryColorBg primaryColorBorder primaryColorBorderDarkenHover mb-5'
137
+              onClick={this.handleClickNewWorkspace}
138
+            >
139
+              {t('Create a workspace')}
140
+            </button>
144 141
           </div>
145 142
 
146
-          <div className='sidebar__footer mb-2'>
147
-            <div className='sidebar__footer__text whiteFontColor d-flex align-items-end justify-content-center'>
148
-              Copyright - 2013 - 2018
149
-              <div className='sidebar__footer__text__link'>
150
-                <a href='http://www.tracim.fr/' target='_blank' className='ml-3'>tracim.fr</a>
151
-              </div>
143
+        </div>
144
+
145
+        <div className='sidebar__footer mb-2'>
146
+          <div className='sidebar__footer__text whiteFontColor d-flex align-items-end justify-content-center'>
147
+            Copyright - 2013 - 2018
148
+            <div className='sidebar__footer__text__link'>
149
+              <a href='http://www.tracim.fr/' target='_blank' className='ml-3'>tracim.fr</a>
152 150
             </div>
153 151
           </div>
154 152
         </div>

+ 80 - 77
frontend/src/css/Sidebar.styl View File

@@ -15,8 +15,12 @@ leftside()
15 15
   background-color rgba(253, 253, 253, 0.3)
16 16
 
17 17
 .sidebar
18
+  display flex
19
+  flex-direction column
20
+  justify-content space-between
18 21
   position relative
19 22
   transition all sidebar-animate-speed
23
+  width sidebar-width
20 24
   min-height 100%
21 25
   background-image url('../img/applat.png')
22 26
   background-repeat repeat
@@ -25,8 +29,7 @@ leftside()
25 29
     width 0
26 30
   &__expand
27 31
     position absolute
28
-    top 0
29
-    right -43px
32
+    right -42px
30 33
     display flex
31 34
     justify-content center
32 35
     align-items center
@@ -37,74 +40,79 @@ leftside()
37 40
     cursor pointer
38 41
     color white
39 42
     transition all sidebar-animate-speed
40
-  &__btnnewworkspace
41
-    margin 50px 0
42
-    overflow hidden
43
-    &__btn
44
-      display block
45
-      margin 0 auto
46
-      padding 15px 30px
47
-  &__navigation
48
-    padding 0
49
-    width sidebar-width
50
-    overflow hidden
51
-    &__workspace
52
-      padding-left 0
53
-      list-style none
54
-      &__item
55
-        &__wrapper
56
-          display flex
57
-          align-items center
58
-          border-bottom 1px solid
59
-          width 100%
60
-          height 100%
61
-          cursor pointer
62
-        &__number
63
-          display flex
64
-          leftside()
65
-          padding 12px
66
-          width 50px
67
-          letter-spacing 2px
68
-        &__name
69
-          padding 10px
70
-          font-size 20px
71
-          color off-white
72
-          white-space nowrap
73
-          overflow hidden
74
-          text-overflow ellipsis
75
-        &__icon
76
-          margin 0 10px 0 auto
77
-          color white
78
-        &__submenu
79
-          margin 0
80
-          padding 0
81
-          width 100%
82
-          overflow hidden
83
-          & > li
84
-            display block
85
-          &__dropdown
43
+  &__content
44
+    height 100%
45
+    &__btnnewworkspace
46
+      margin 50px 0
47
+      overflow hidden
48
+      &__btn
49
+        display block
50
+        margin 0 auto
51
+        padding 15px 30px
52
+    &__navigation
53
+      padding 0
54
+      width sidebar-width
55
+      transition all sidebar-animate-speed
56
+      overflow hidden
57
+      &.sidebarclose
58
+        width 0
59
+      &__workspace
60
+        padding-left 0
61
+        list-style none
62
+        &__item
63
+          &__wrapper
86 64
             display flex
87 65
             align-items center
88 66
             border-bottom 1px solid
67
+            width 100%
68
+            height 100%
89 69
             cursor pointer
90
-            &__showdropdown
70
+          &__number
71
+            display flex
72
+            leftside()
73
+            padding 12px
74
+            width 50px
75
+            letter-spacing 2px
76
+          &__name
77
+            padding 10px
78
+            font-size 20px
79
+            color off-white
80
+            white-space nowrap
81
+            overflow hidden
82
+            text-overflow ellipsis
83
+          &__icon
84
+            margin 0 10px 0 auto
85
+            color white
86
+          &__submenu
87
+            margin 0
88
+            padding 0
89
+            width 100%
90
+            overflow hidden
91
+            & > li
92
+              display block
93
+            &__dropdown
91 94
               display flex
92
-              justify-content space-between
93 95
               align-items center
94
-              padding 0 10px
95
-              width 100%
96
-            .dropdown__icon
97
-              padding 10px 15px
98
-              min-width 50px
99
-              leftside()
100
-            .dropdown__title
101
-              white-space nowrap
102
-              overflow hidden
103
-              text-overflow ellipsis
104
-              // color off-white
105
-            &.activeFilter
96
+              border-bottom 1px solid
97
+              cursor pointer
98
+              &__showdropdown
99
+                display flex
100
+                justify-content space-between
101
+                align-items center
102
+                padding 0 10px
103
+                width 100%
106 104
               .dropdown__icon
107
-                background-color rgba(253, 253, 253, 0.8)
105
+                padding 10px 15px
106
+                min-width 50px
107
+                leftside()
108
+              .dropdown__title
109
+                white-space nowrap
110
+                overflow hidden
111
+                text-overflow ellipsis
112
+                // color off-white
113
+              &.activeFilter
114
+                .dropdown__icon
115
+                  background-color rgba(253, 253, 253, 0.8)
108 116
   &__footer
109 117
     &__text
110 118
       font-size 14px
@@ -116,22 +124,19 @@ leftside()
116 124
             text-decoration underline
117 125
             color fourthColor
118 126
 
119
-/***** MEDIA 992px and 1199px ******/
120
-
121
-@media (min-width: min-lg) and (max-width: max-lg)
122 127
 
123
-  .sidebar
124
-    position fixed
128
+/***** MEDIA 576px and 1199px ******/
125 129
 
126
-/***** MEDIA 576px and 991px ******/
130
+// Regroup the css rules in one mediaqueries
127 131
 
128
-@media (min-width: min-sm) and (max-width: max-md)
132
+@media (min-width: min-sm) and (max-width: max-lg)
129 133
 
130
-  .sidebarSticky
131
-    top 69px
134
+  .sidebarpagecontainer
135
+    position relative
132 136
 
133 137
   .sidebar
134
-    position fixed
138
+    position absolute
139
+
135 140
 
136 141
 /***** MEDIA 576px and 767px *****/
137 142
 
@@ -145,10 +150,8 @@ leftside()
145 150
 @media (max-width: 575px)
146 151
 
147 152
   .sidebarpagecontainer
153
+    position relative
148 154
     padding-top 69px
149 155
 
150
-  .sidebarSticky
151
-    top 69px
152
-
153 156
   .sidebar
154
-    position fixed
157
+    position absolute