Skip to content

Commit fb3456c

Browse files
marie-jjleveugle
authored andcommitted
fix: fix responsive sidebar menu
1 parent e8c3635 commit fb3456c

File tree

13 files changed

+109
-17
lines changed

13 files changed

+109
-17
lines changed

packages/manager/apps/public-cloud/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@ovh-ux/manager-pci": "^0.1.0-alpha.0",
2121
"@ovh-ux/manager-telecom-styles": "^2.0.2",
2222
"@ovh-ux/ng-at-internet": "^4.0.0",
23+
"@ovh-ux/ng-ovh-actions-menu": "^5.0.0-alpha.0",
2324
"@ovh-ux/ng-ovh-api-wrappers": "^3.0.0",
2425
"@ovh-ux/ng-ovh-cloud-universe-components": "^1.1.0-alpha.0",
2526
"@ovh-ux/ng-ovh-contacts": "^1.0.1",
@@ -47,6 +48,7 @@
4748
"angular-ui-bootstrap": "^1.3.3",
4849
"angular-ui-validate": "^1.2.3",
4950
"bootstrap-tour": "^0.12.0",
51+
"angular-vs-repeat": "^2.0.13",
5052
"bootstrap4": "twbs/bootstrap#v4.0.0",
5153
"font-awesome": "^4.0.0",
5254
"jquery": "^2.1.3",

packages/manager/apps/public-cloud/src/assets/theme/_navbar.less

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@import "~ovh-ui-kit/packages/oui/_settings";
12
@import "~ovh-ui-kit/packages/oui-color/_variables";
23
@import "~ovh-ui-kit/packages/oui-icons/_icons";
34
@import "~ovh-ui-kit/packages/oui-navbar/_variables";
@@ -35,6 +36,10 @@
3536
}
3637
}
3738

39+
.oui-navbar-toggler__hamburger span {
40+
background: @primary-color;
41+
}
42+
3843
.oui-navbar-link {
3944
color: rgb(17, 63, 109);
4045

@@ -77,6 +82,20 @@
7782
display: none;
7883
}
7984

85+
.oui-navbar-menu_toggle {
86+
button.oui-navbar-link::after {
87+
content: @oui-icon-index-chevron-right;
88+
font-family: @oui-global-base-font-family-icon;
89+
font-size: @oui-navbar-arrow-size;
90+
color: @oui-navbar-arrow-color;
91+
padding: 0;
92+
position: absolute;
93+
top: 50%;
94+
right: @oui-navbar-arrow-spacing;
95+
transform: translateY(-50%);
96+
}
97+
}
98+
8099
// Languages menu
81100
&-menu {
82101
&_language &__item_active {

packages/manager/apps/public-cloud/src/assets/theme/_sidebar.less

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@import '~ovh-ui-kit/packages/oui-responsive/_variables.less';
12
@import './_variables.less';
23

34
cloud-sidebar { /* stylelint-disable-line */
@@ -6,9 +7,12 @@ cloud-sidebar { /* stylelint-disable-line */
67
width: 100%;
78
height: 100%;
89
z-index: 1;
9-
position: relative;
1010
box-shadow: 0 2pt 10pt rgba(40, 89, 192, 0.25);
1111

12+
.oui-navbar-backdrop_active {
13+
z-index: 1;
14+
}
15+
1216
oui-clipboard { /* stylelint-disable-line */
1317
margin-bottom: 0;
1418

@@ -90,6 +94,11 @@ cloud-sidebar { /* stylelint-disable-line */
9094
padding: 0 8pt;
9195
width: 100%;
9296
box-sizing: inherit;
97+
98+
.oui-sidebar-link_active,
99+
.oui-sidebar-link[aria-expanded="true"] {
100+
background-color: #fff;
101+
}
93102
}
94103

95104
.oui-sidebar-list__item {
@@ -173,6 +182,17 @@ cloud-sidebar { /* stylelint-disable-line */
173182
}
174183
}
175184
}
185+
186+
&_fixed {
187+
opacity: 1;
188+
position: relative;
189+
transform: none;
190+
box-shadow: none;
191+
}
192+
193+
.oui-sidebar-menu__header {
194+
display: none;
195+
}
176196
}
177197
}
178198
}

packages/manager/apps/public-cloud/src/index.controller.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@ import angular from 'angular';
33
import feedback from './feedback-icon.svg';
44
import { BREAKPOINT, KEY } from './components/walkMe/walkme.constants';
55

6+
import options from './navbar.config';
7+
68
export default class PublicCloudController {
79
/* @ngInject */
810
constructor($scope, $window, ovhUserPref, WalkMe) {
11+
this.$scope = $scope;
12+
this.$window = $window;
913
this.feedbackUrl = __FEEDBACK_URL__;
1014
this.feedback = feedback;
1115
this.ovhUserPref = ovhUserPref;
1216
this.WalkMe = WalkMe;
1317

18+
19+
this.navbarOptions = options;
20+
1421
$scope.$on('navbar.loaded', () => this.ovhUserPref.getValue(KEY)
1522
.then(({ value }) => {
1623
this.shouldShowWalkMe = value;

packages/manager/apps/public-cloud/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<body class="ovhstack h-100" style="overflow: hidden;">
99
<div data-ng-app="ovhStack" data-ng-strict-di class="h-100 d-flex flex-column overflow-hidden" data-ng-controller="PublicCloudController as $ctrl">
1010
<div>
11-
<ovh-manager-navbar data-navbar-options="{ universe: 'public-cloud' }"></ovh-manager-navbar>
11+
<ovh-manager-navbar data-navbar-options="$ctrl.navbarOptions"></ovh-manager-navbar>
1212
</div>
1313
<div class="d-flex w-100 h-100 position-relative">
1414
<div class="w-100 h-100 position-absolute" style="top: 0; left: 0;">
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
toggle: {
3+
event: 'sidebar:loaded',
4+
},
5+
universe: 'public-cloud',
6+
};

packages/manager/modules/navbar/src/controller.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,25 @@ export default class {
6363
url: url || '#',
6464
isPrimary: !NON_PRIMARY_ITEMS.includes(name),
6565
}));
66+
this.responsiveLinks = universes.map(({ universe: name, url }) => {
67+
const link = ({
68+
name,
69+
title: this.$translate.instant(`navbar_universe_${name}`),
70+
isPrimary: !NON_PRIMARY_ITEMS.includes(name),
71+
});
72+
73+
if (name === this.navbarOptions.universe) {
74+
link.click = () => {
75+
this.toggleSidebar();
76+
this.$scope.$emit('navbar:onUniverseClick');
77+
};
78+
link.isActive = true;
79+
} else {
80+
link.url = url || '#';
81+
}
82+
83+
return link;
84+
});
6685
});
6786
}
6887

packages/manager/modules/navbar/src/template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
<oui-navbar-toggler data-ng-if="$ctrl.navbarOptions.toggle"
2828
data-on-click="$ctrl.toggleSidebar()"
2929
data-active="$ctrl.togglerActive"
30-
data-loading="$ctrl.togglerisLoading">
30+
data-loading="$ctrl.togglerisLoading"
31+
data-links="$ctrl.responsiveLinks">
3132
</oui-navbar-toggler>
3233
</oui-navbar>
3334

packages/manager/modules/pci/src/projects/project/project.controller.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { ACTIONS, LINKS } from './project.constants';
22

33
export default class ProjectController {
44
/* @ngInject */
5-
constructor($state, $stateParams, OvhApiCloudProject) {
5+
constructor($scope, $state, $stateParams, $transitions, OvhApiCloudProject) {
6+
this.$scope = $scope;
67
this.$state = $state;
78
this.$stateParams = $stateParams;
9+
this.$transitions = $transitions;
810
this.OvhApiCloudProject = OvhApiCloudProject;
911
this.loading = false;
1012

@@ -16,6 +18,21 @@ export default class ProjectController {
1618

1719
$ngInit() {
1820
this.loading = true;
21+
this.isSidebarOpen = false;
22+
23+
this.$scope.$on('sidebar:toggle', () => {
24+
this.isSidebarOpen = !this.isSidebarOpen;
25+
});
26+
27+
this.$scope.$on('navbar:toggle', () => {
28+
if (this.isSidebarOpen) {
29+
this.isSidebarOpen = false;
30+
}
31+
});
32+
33+
this.$transitions.onStart({}, () => {
34+
this.isSidebarOpen = false;
35+
});
1936

2037
return this.OvhApiCloudProject
2138
.v6()

packages/manager/modules/pci/src/projects/project/project.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<div class="container-fluid h-100">
22
<div class="row h-100">
3-
<div class="col-md-2 p-0 h-100 d-none d-md-flex flex-column">
3+
<div class="col-md-2 p-0 h-100 d-md-flex flex-column"
4+
data-ng-class="{
5+
'd-none': !$ctrl.isSidebarOpen
6+
}">
47
<cloud-sidebar></cloud-sidebar>
58
</div>
69
<div class="h-100 position-relative col-md-10 p-0">

0 commit comments

Comments
 (0)