Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#9): update menu #128

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
},
type: {
type: String,
default: 'collapsible'
default: undefined
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/components/MenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@

<!-- Children - Collapsible -->
<div
v-if="isCollapsible && hasChildren"
v-if="!isFlyout && hasChildren"
class="ct-menu__sub-menu__wrapper"
:class="{
[`ct-menu__sub-menu__wrapper--level-${level + 1}`]: true,
}"
data-collapsible-panel
data-collapsible-trigger-no-icon
:data-collapsible-panel="isCollapsible"
:data-collapsible-trigger-no-icon="isCollapsible"
>
<CTMenu
class="ct-menu__sub-menu"
:level="level + 1"
:items="item.children"
:theme="theme"
/>
</div>

<!-- Children - Flyout -->
<CTFlyout v-if="isFlyout && hasChildren">
<CTFlyout v-else-if="isFlyout && hasChildren">
<template #open-button>
<CTButton
class="ct-mobile-navigation__open-subsection-trigger"
Expand Down Expand Up @@ -73,6 +74,7 @@
:items="item.children"
:level="level + 1"
type="flyout"
:theme="theme"
/>
</div>
</CTFlyout>
Expand All @@ -96,7 +98,7 @@ export default {
},
type: {
type: String,
default: 'collapsible'
default: undefined
}
},

Expand Down
5 changes: 4 additions & 1 deletion src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class="ct-navigation__menu"
:theme="theme"
:items="items"
:type="type"
/>
</slot>
</div>
Expand Down Expand Up @@ -40,7 +41,9 @@ export default {
},

computed: {
dropdownClass: ({ dropdown }) => `ct-navigation--${dropdown}`
dropdownClass: ({ dropdown }) => `ct-navigation--${dropdown}`,

type: ({ dropdown }) => dropdown === 'dropdown' ? 'collapsible' : undefined,
Comment on lines 41 to +46
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type computed property is correctly defined based on the dropdown prop. However, it's a good practice to add a comment explaining the logic behind this computation for future reference.

+    // If dropdown is set to 'dropdown', type is set to 'collapsible'; otherwise, it is set to undefined.
     type: ({ dropdown }) => dropdown === 'dropdown' ? 'collapsible' : undefined,

Commitable suggestion

[!IMPORTANT]
Carefully review the code before committing. Make sure it correctly replaces the highlighted code, has no missing lines and indentaion issues.

Suggested change
},
computed: {
dropdownClass: ({ dropdown }) => `ct-navigation--${dropdown}`
dropdownClass: ({ dropdown }) => `ct-navigation--${dropdown}`,
type: ({ dropdown }) => dropdown === 'dropdown' ? 'collapsible' : undefined,
},
computed: {
dropdownClass: ({ dropdown }) => `ct-navigation--${dropdown}`,
// If dropdown is set to 'dropdown', type is set to 'collapsible'; otherwise, it is set to undefined.
type: ({ dropdown }) => dropdown === 'dropdown' ? 'collapsible' : undefined,

}
}
</script>
Loading