-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathslds-vertical-navigation.vue
74 lines (56 loc) · 1.54 KB
/
slds-vertical-navigation.vue
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
<template>
<nav :class="verticalNavigationClassNames">
<!-- Quickfind -->
<div v-if="hasQuickfind" class="slds-form-element slds-p-horizontal_large slds-p-top_large">
<slds-input v-model="search" icon="utility:search" placeholder="Quick Find"/>
</div>
<!-- Sections/Items -->
<div class="slds-scrollable_y">
<slot/>
</div>
</nav>
</template>
<script lang="ts">
import SldsInput from "../slds-input/slds-input.vue"
import { defineComponent } from "vue"
export default defineComponent({
name: "SldsVerticalNavigation",
components: { SldsInput },
props: {
/**
* Active item name.
*/
active: String,
compact: Boolean,
hasQuickfind: Boolean,
shaded: Boolean,
},
data() {
return {
search: null,
}
},
computed: {
/**
* The CSS class names for the vertical navigation.
*/
verticalNavigationClassNames(): string {
let classNames = "slds-nav-vertical"
if (this.shaded) classNames += " slds-nav-vertical_shade"
if (this.compact) classNames += " slds-nav-vertical_compact"
if (this.hasQuickfind) classNames += " slds-nav-vertical_has-quickfind"
return classNames
},
},
})
</script>
<style scoped lang="scss">
.slds-nav-vertical {
height: 100%;
}
.slds-nav-vertical_has-quickfind {
.slds-scrollable_y {
max-height: calc(100% - 3.5rem);
}
}
</style>