Skip to content

Commit

Permalink
feat: add top property for v-navigation-drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiKhoshnevisz committed Nov 6, 2023
1 parent 5de66af commit df70bfe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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

0 comments on commit df70bfe

Please sign in to comment.