Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Make focussed app menu entry wider to see full name
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Aug 8, 2024
commit ed167930896cee93523780675a05d971e16c1a43
16 changes: 15 additions & 1 deletion core/src/components/AppMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<nav ref="appMenu"
class="app-menu"
:aria-label="t('core', 'Applications menu')">
<ul class="app-menu__list">
<ul :aria-label="t('core', 'Apps')"
class="app-menu__list">
<AppMenuEntry v-for="app in mainAppList"
:key="app.id"
:app="app" />
Expand Down Expand Up @@ -112,13 +113,26 @@ export default defineComponent({

<style scoped lang="scss">
.app-menu {
// The size the currently focussed entry will grow to show the full name
--app-menu-entry-growth: calc(var(--default-grid-baseline) * 4);
display: flex;
flex: 1 1;
width: 0;

&__list {
display: flex;
flex-wrap: nowrap;
margin-inline: calc(var(--app-menu-entry-growth) / 2);
transition: margin-inline var(--animation-quick) ease-in-out;

// Remove padding if the first child is focussed
&:has(.app-menu-entry:hover:first-child, .app-menu-entry:focus-within:first-child) {
margin-inline: 0 calc(var(--app-menu-entry-growth) / 2);
}
// Remove padding if the last child is focussed
&:has(.app-menu-entry:hover:last-child, .app-menu-entry:focus-within:last-child) {
margin-inline: calc(var(--app-menu-entry-growth) / 2) 0;
}
}

&__overflow {
Expand Down
30 changes: 28 additions & 2 deletions core/src/components/AppMenuEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ defineProps<{
width: var(--header-height);
height: var(--header-height);
position: relative;
// Needed to prevent jumping when hover an entry (keep in sync with :hover styles)
transition: width var(--animation-quick) ease-in-out;

&__link {
position: relative;
Expand Down Expand Up @@ -95,21 +97,45 @@ defineProps<{
left: 50%;
bottom: 8px;
display: block;
transition: all 0.1s ease-in-out;
transition: all var(--animation-quick) ease-in-out;
opacity: 1;
}
}

&__icon,
&__label {
transition: all 0.1s ease-in-out;
transition: all var(--animation-quick) ease-in-out;
}

// Make the hovered entry bold to see that it is hovered
&:hover .app-menu-entry__label,
&:focus-within .app-menu-entry__label {
font-weight: bold;
}

// Adjust the width when an entry is focussed
// The focussed / hovered entry should grow, while both neighbors need to shrink
&:hover,
&:focus-within {
width: calc(var(--header-height) + var(--app-menu-entry-growth));

// The next entry needs to shrink half the growth
+ .app-menu-entry {
width: calc(var(--header-height) - (var(--app-menu-entry-growth) / 2));
.app-menu-entry__icon {
margin-inline-end: calc(var(--app-menu-entry-growth) / 2);
}
}
}

// The previous entry needs to shrink half the growth
&:has(+ .app-menu-entry:hover),
&:has(+ .app-menu-entry:focus-within) {
width: calc(var(--header-height) - (var(--app-menu-entry-growth) / 2));
.app-menu-entry__icon {
margin-inline-start: calc(var(--app-menu-entry-growth) / 2);
}
}
}
</style>

Expand Down