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(VNavigationDrawer): adding top property for navigation drawer component in vuetify 2 #18607

Open
wants to merge 3 commits into
base: v2-stable
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"props": {
"bottom": "Expands from the bottom of the screen on mobile devices",
"top": "Expands from the top of the screen on mobile devices",
"clipped": "A clipped drawer rests under the application toolbar. **Note:** requires the **clipped-left** or **clipped-right** prop on `v-app-bar` to work as intended",
"disableResizeWatcher": "Will automatically open/close drawer when resized depending if mobile or desktop.",
"disableRouteWatcher": "Disables opening of navigation drawer when route changes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
bottom: 0
min-width: 100%

.v-navigation-drawer--top.v-navigation-drawer--is-mobile
top: 0
bottom: auto
min-width: 100%

.v-navigation-drawer--right
left: auto
right: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default baseMixins.extend({
},
},
temporary: Boolean,
top: Boolean,
touchless: Boolean,
width: {
type: [Number, String],
Expand Down Expand Up @@ -135,6 +136,7 @@ export default baseMixins.extend({
'v-navigation-drawer--open-on-hover': this.expandOnHover,
'v-navigation-drawer--right': this.right,
'v-navigation-drawer--temporary': this.temporary,
'v-navigation-drawer--top': this.top,
...this.themeClasses,
}
},
Expand Down Expand Up @@ -165,6 +167,7 @@ export default baseMixins.extend({
computedTransform (): number {
if (this.isActive) return 0
if (this.isBottom) return 100
if (this.isTop) return -100
return this.right ? 100 : -100
},
computedWidth (): string | number {
Expand All @@ -179,6 +182,9 @@ export default baseMixins.extend({
isBottom (): boolean {
return this.bottom && this.isMobile
},
isTop (): boolean {
return this.top && this.isMobile
},
isMiniVariant (): boolean {
return (
!this.expandOnHover &&
Expand Down Expand Up @@ -229,9 +235,9 @@ export default baseMixins.extend({
)
},
styles (): object {
const translate = this.isBottom ? 'translateY' : 'translateX'
const translate = this.isBottom || this.isTop ? 'translateY' : 'translateX'
return {
height: convertToUnit(this.height),
height: !this.isTop ? convertToUnit(this.height) : 'auto',
top: !this.isBottom ? convertToUnit(this.computedTop) : 'auto',
maxHeight: this.computedMaxHeight != null
? `calc(100% - ${convertToUnit(this.computedMaxHeight)})`
Expand Down
Loading