Skip to content

Commit 3309cc7

Browse files
committed
Update bouncernav section (compatibility with K4)
1 parent ddb8812 commit 3309cc7

File tree

4 files changed

+74
-50
lines changed

4 files changed

+74
-50
lines changed

index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/css/styles.scss

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.k-panel.bouncer-padding-top .k-panel-main {
2+
padding-top: 0;
3+
}
4+
5+
.k-sections {
6+
.bouncer-nav {
7+
display: none;
8+
}
9+
}
10+
11+
.k-panel[data-menu="false"] {
12+
.bouncer-nav-container {
13+
margin-inline-start: 0;
14+
}
15+
}
16+
.bouncer-nav {
17+
&-container {
18+
position: sticky;
19+
top: 0;
20+
width: 100%;
21+
margin-inline-start: var(--menu-width);
22+
height: 40px;
23+
background: #f6f6f6;
24+
border-bottom: 1px solid var(--color-border);
25+
display: flex;
26+
align-items: center;
27+
font-size: 0.75rem;
28+
padding: 0 1rem;
29+
margin-bottom: 1.5rem;
30+
z-index: 301;
31+
}
32+
&-inner {
33+
width: 100%;
34+
strong {
35+
margin-right: 8px;
36+
}
37+
.page {
38+
display: inline-block;
39+
}
40+
.page + .page {
41+
&:before {
42+
content: '';
43+
margin-left: 8px;
44+
margin-right: 8px;
45+
}
46+
}
47+
a {
48+
border-bottom: 1px solid rgba(0, 0, 0, .2);
49+
transition: border-color .2s ease;
50+
&:hover {
51+
border-color: black;
52+
}
53+
}
54+
}
55+
}

src/components/BouncerNav.vue

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<template>
22
<div v-if="show" class="bouncer-nav">
3-
<div class="bouncer-nav-inner">
4-
<strong>Basculer vers :</strong>
5-
<div v-for="page in pages" class="page">
6-
<k-link :to="page.path">{{ page.title }}</k-link>
3+
<div class="bouncer-nav-container">
4+
<div class="bouncer-nav-inner">
5+
<strong>Basculer vers :</strong>
6+
<div v-for="page in pages" class="page">
7+
<k-link :to="page.path">{{ page.title }}</k-link>
8+
</div>
79
</div>
810
</div>
911
</div>
@@ -20,7 +22,16 @@ export default {
2022
this.$api.get('current-user').then(user => {
2123
this.user = user;
2224
if(this.showBar(user)) {
23-
this.$root.$el.classList.add('bouncer-padding-top')
25+
this.$nextTick(() => {
26+
let _panel = this.$root.$el
27+
let _main = _panel.querySelector('.k-panel-main')
28+
let _bar = _panel.querySelector('.k-sections .bouncer-nav-container')
29+
let _prevBar = document.querySelector('.k-panel > .bouncer-nav-container')
30+
31+
_panel.classList.add('bouncer-padding-top')
32+
_prevBar && _prevBar.remove()
33+
_panel.insertBefore(_bar, _main)
34+
})
2435
}
2536
});
2637
},
@@ -42,47 +53,5 @@ export default {
4253
</script>
4354

4455
<style lang="scss">
45-
.bouncer-padding-top .k-page-view {
46-
padding-top: 40px;
47-
}
48-
.bouncer-nav {
49-
position: fixed;
50-
top: 0;
51-
width: 100%;
52-
left: 0;
53-
height: 40px;
54-
background: lighten(#81a3be, 15%);
55-
display: flex;
56-
align-items: center;
57-
font-size: 0.75rem;
58-
padding-bottom: 0;
59-
&-inner {
60-
width: 100%;
61-
padding: 0 3rem;
62-
margin: 0 auto;
63-
max-width: 100rem;
64-
strong {
65-
margin-right: 8px;
66-
}
67-
.page {
68-
display: inline-block;
69-
}
70-
.page + .page {
71-
&:before {
72-
content: '';
73-
margin-left: 8px;
74-
margin-right: 8px;
75-
}
76-
}
77-
a {
78-
border-bottom: 1px solid rgba(0, 0, 0, .15);
79-
&:hover {
80-
border-color: black;
81-
}
82-
}
83-
@media screen and (min-width: 90em) {
84-
padding: 0 6rem;
85-
}
86-
}
87-
}
56+
@import '../assets/css/styles.scss';
8857
</style>

0 commit comments

Comments
 (0)