Skip to content

Commit db5fb1e

Browse files
author
Dobromir Hristov
committed
refactor: reduce item height
1 parent f71e95b commit db5fb1e

File tree

2 files changed

+35
-11
lines changed

2 files changed

+35
-11
lines changed

src/components/Navigator/NavigatorCardItem.vue

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
:class="{ expanded, 'extra-info': showExtendedInfo }"
55
:style="{ '--nesting-index': item.depth }"
66
>
7-
<div class="head-wrapper" :class="{ active: isActive }">
7+
<div class="head-wrapper" :class="{ active: isActive, 'is-group': isGroupMarker }">
88
<button
99
v-if="item.childUIDs.length"
1010
class="tree-toggle"
1111
@click.prevent="toggleTree"
1212
>
1313
<InlineChevronRightIcon class="icon-inline chevron" :class="{ rotate: expanded }" />
1414
</button>
15-
<NavigatorLeafIcon :kind="item.kind" />
15+
<NavigatorLeafIcon v-if="!isGroupMarker" :kind="item.kind" class="navigator-icon" />
1616
<div class="title-container">
17-
<router-link :to="item.path" class="leaf-link">
17+
<Reference :url="item.path" class="leaf-link" :isActive="!isGroupMarker">
1818
<HighlightMatches
1919
:text="item.title"
2020
:matcher="filterPattern"
2121
/>
22-
</router-link>
22+
</Reference>
2323
<ContentNode
2424
v-if="item.abstract"
2525
v-show="showExtendedInfo"
@@ -36,6 +36,8 @@ import InlineChevronRightIcon from 'theme/components/Icons/InlineChevronRightIco
3636
import NavigatorLeafIcon from 'docc-render/components/Navigator/NavigatorLeafIcon.vue';
3737
import ContentNode from 'docc-render/components/DocumentationTopic/ContentNode.vue';
3838
import HighlightMatches from 'docc-render/components/Navigator/HighlightMatches.vue';
39+
import Reference from 'docc-render/components/ContentNode/Reference.vue';
40+
import { TopicKind } from '@/constants/kinds';
3941
4042
export default {
4143
name: 'NavigatorCardItem',
@@ -44,6 +46,7 @@ export default {
4446
ContentNode,
4547
NavigatorLeafIcon,
4648
InlineChevronRightIcon,
49+
Reference,
4750
},
4851
props: {
4952
item: {
@@ -67,6 +70,9 @@ export default {
6770
default: false,
6871
},
6972
},
73+
computed: {
74+
isGroupMarker: ({ item: { kind } }) => kind === TopicKind.groupMarker,
75+
},
7076
methods: {
7177
toggleTree() {
7278
this.$emit('toggle', this.item);
@@ -79,18 +85,18 @@ export default {
7985
@import 'docc-render/styles/_core.scss';
8086
8187
.navigator-card-item {
82-
height: 40px;
88+
height: 32px;
8389
display: flex;
8490
align-items: center;
8591
padding-right: var(--card-horizontal-spacing);
8692
8793
&.extra-info {
88-
height: 60px;
94+
height: 53px;
8995
}
9096
}
9197
9298
.head-wrapper {
93-
padding: 7.5px 5px 7.5px calc(var(--nesting-index) * 10px + 24px);
99+
padding: 5.5px 5px 5.5px calc(var(--nesting-index) * 10px + 24px);
94100
position: relative;
95101
display: flex;
96102
align-items: baseline;
@@ -102,6 +108,16 @@ export default {
102108
background: var(--color-fill-gray-quaternary);
103109
}
104110
111+
&.is-group {
112+
.leaf-link {
113+
color: var(--color-figure-gray-secondary);
114+
}
115+
116+
&:hover {
117+
background: inherit;
118+
}
119+
}
120+
105121
&:hover {
106122
background: var(--color-fill-light-blue);
107123
@@ -110,15 +126,20 @@ export default {
110126
}
111127
}
112128
129+
.navigator-icon {
130+
display: flex;
131+
transform: translateY(3px);
132+
}
133+
113134
.leaf-link {
114135
color: var(--color-figure-gray);
115136
text-overflow: ellipsis;
116137
overflow: hidden;
117138
white-space: nowrap;
118139
max-width: 100%;
119-
display: inline-block;
140+
display: inline;
120141
vertical-align: middle;
121-
@include font-styles(body-reduced);
142+
@include font-styles(body-reduced-tight);
122143
123144
&:after {
124145
content: '';
@@ -145,10 +166,13 @@ export default {
145166
width: 10px;
146167
margin-left: -15px;
147168
margin-right: 5px;
169+
display: flex;
148170
}
149171
150172
.title-container {
151173
min-width: 0;
174+
display: flex;
175+
flex-flow: column;
152176
}
153177
154178
.chevron {

src/constants/sidebar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const INDEX_ROOT_KEY = '<root>';
22
export const LEAF_SIZES = {
3-
min: 40,
4-
max: 60,
3+
min: 32,
4+
max: 53,
55
};

0 commit comments

Comments
 (0)