-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathHeaderBar.vue
More file actions
102 lines (89 loc) · 1.72 KB
/
HeaderBar.vue
File metadata and controls
102 lines (89 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!--
- SPDX-FileCopyrightText: 2018 Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import { ref } from 'vue'
const clamped = ref(true)
/**
* Toggles the clamped state
*/
function toggleClamp() {
clamped.value = !clamped.value
}
</script>
<template>
<div class="header_bar">
<div class="header_bar_top">
<div class="bar_top_left">
<div :class="['header_title', { clamped }]" @click="toggleClamp()">
<slot name="title" />
</div>
<div class="bar_top_left_sub">
<slot name="sub" />
</div>
</div>
<div class="bar_top_right">
<slot name="right" />
</div>
</div>
<div class="header_bar_bottom">
<slot />
</div>
</div>
</template>
<style lang="scss">
.page--scrolled .header_bar_bottom {
display: none;
}
.scrolled .header_bar {
box-shadow: 6px 6px 6px var(--color-box-shadow);
}
.header_bar {
position: sticky;
top: 0;
margin-left: -8px;
margin-right: -8px;
padding-right: 8px;
padding-left: 56px;
background-color: var(--color-main-background);
border-bottom: 1px solid var(--color-border);
z-index: 9;
transition: all var(--animation-slow) linear;
.header_bar_top {
display: flex;
flex-wrap: wrap-reverse;
justify-content: flex-end;
gap: 8px;
min-height: 3em;
.bar_top_left {
display: flex;
flex-direction: column;
flex: 1 180px;
justify-content: center;
}
.bar_top_right {
display: flex;
flex: 1;
justify-content: flex-end;
gap: 8px;
flex-wrap: wrap;
}
.header_title {
font-weight: bold;
font-size: 1em;
line-height: 1.5em;
}
.sub {
display: flex;
flex-wrap: wrap;
}
}
.header_bar_bottom {
margin-bottom: 1rem;
}
[class*='bar_'] {
flex: 0;
}
}
</style>