Skip to content

Commit efb088e

Browse files
fix: also use wrap for navigation-items that are no buttons (#4099)
* fix: also use wrap for navigation-items that are no buttons * fix: show caret on the right of navigation-item
1 parent e861be6 commit efb088e

File tree

11 files changed

+43
-29
lines changed

11 files changed

+43
-29
lines changed

packages/components/src/components/navigation-item/navigation-item.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
white-space: nowrap; // we don't want to break
6363
text-align: center;
6464
align-items: center; // Centering the content vertically and horizontally
65+
justify-content: space-between;
6566

6667
@include helpers.hover {
6768
background-color: colors.$db-adaptive-bg-basic-transparent-hovered;
@@ -88,11 +89,9 @@
8889
inline-size: auto;
8990

9091
&[data-wrap="true"] {
91-
.db-navigation-item-expand-button {
92-
&:is(button) {
93-
white-space: normal;
94-
text-align: start;
95-
}
92+
:is(a, .db-navigation-item-expand-button):first-of-type {
93+
white-space: normal;
94+
text-align: start;
9695
}
9796
}
9897

showcases/angular-showcase/src/app/components/navigation-item/navigation-item.component.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@
3636
[showIcon]="exampleProps?.showIcon"
3737
>
3838
<ng-container *dbNavigationContent>
39-
<a href="#">Test1</a>
39+
Also a navigation item with longer label
4040
</ng-container>
41-
</db-navigation-item>
42-
<db-navigation-item
43-
[icon]="exampleProps?.icon"
44-
[showIcon]="exampleProps?.showIcon"
45-
>
46-
<ng-container *dbNavigationContent>
47-
<a href="#">Test2</a>
41+
<ng-container sub-navigation>
42+
<db-navigation-item
43+
[icon]="exampleProps?.icon"
44+
[showIcon]="exampleProps?.showIcon"
45+
>
46+
<ng-container *dbNavigationContent>
47+
<a href="#">Navigation-Item 2</a>
48+
</ng-container>
49+
</db-navigation-item>
4850
</ng-container>
4951
</db-navigation-item>
5052
<db-navigation-item
5153
[icon]="exampleProps?.icon"
5254
[showIcon]="exampleProps?.showIcon"
5355
>
5456
<ng-container *dbNavigationContent>
55-
<a href="#">Test3</a>
57+
<a href="#">Navigation-Item 1</a>
5658
</ng-container>
5759
</db-navigation-item>
5860
</ng-container>

showcases/react-showcase/src/components/navigation-item/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,22 @@ const getNavigationItem = ({
3030
subNavigation={
3131
areaPopup && (
3232
<>
33-
<DBNavigationItem icon={icon} showIcon={showIcon}>
34-
<a href="#">Test1</a>
33+
<DBNavigationItem
34+
icon={icon}
35+
showIcon={showIcon}
36+
subNavigation={
37+
<>
38+
<DBNavigationItem
39+
icon={icon}
40+
showIcon={showIcon}>
41+
<a href="#">Navigation-Item 2</a>
42+
</DBNavigationItem>
43+
</>
44+
}>
45+
Also a navigation item with longer label
3546
</DBNavigationItem>
3647
<DBNavigationItem icon={icon} showIcon={showIcon}>
37-
<a href="#">Test2</a>
48+
<a href="#">Navigation-Item 1</a>
3849
</DBNavigationItem>
3950
</>
4051
)

showcases/shared/navigation-item.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,10 @@
269269
{
270270
"name": "a",
271271
"native": true,
272+
"content": "Sub-Sub-Navi-Item 1",
272273
"props": {
273-
"href": "#",
274-
"icon": "x_placeholder",
275-
"showIcon": true
276-
},
277-
"content": "True"
274+
"href": "#"
275+
}
278276
}
279277
]
280278
},

showcases/vue-showcase/src/components/navigation-item/NavigationItem.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,21 @@ const log = (exampleName?: string) => {
3232
<DBNavigationItem
3333
:icon="exampleProps?.icon"
3434
:showIcon="exampleProps?.showIcon"
35-
><a href="#">Test1</a></DBNavigationItem
3635
>
36+
Also a navigation item with longer label
37+
<template v-slot:sub-navigation>
38+
<DBNavigationItem
39+
:icon="exampleProps?.icon"
40+
:showIcon="exampleProps?.showIcon"
41+
>
42+
<a href="#">Navigation Item 2</a>
43+
</DBNavigationItem>
44+
</template>
45+
</DBNavigationItem>
3746
<DBNavigationItem
3847
:icon="exampleProps?.icon"
3948
:showIcon="exampleProps?.showIcon"
40-
><a href="#">Test2</a></DBNavigationItem
41-
>
42-
<DBNavigationItem
43-
:icon="exampleProps?.icon"
44-
:showIcon="exampleProps?.showIcon"
45-
><a href="#">Test3</a></DBNavigationItem
49+
><a href="#">Navigation Item 1</a></DBNavigationItem
4650
>
4751
</template>
4852
<template v-if="exampleProps?.areaPopup">

0 commit comments

Comments
 (0)