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): add rail prop v-model support #16352

Merged
merged 1 commit into from Jan 3, 2023

Conversation

johnleider
Copy link
Member

Description

Add support for rail v-model. Allows the user to choose to have main content shift with or without the rail expand-on-hover.

Motivation and Context

resolves #16022

How Has This Been Tested?

e2e

Markup:

<template>
  <div class="ma-4 pa-4">
    <v-navigation-drawer
      id="drawer"
      v-model:rail="miniVariant"
      expand-on-hover
      app
      color="#8dca9d"
    >
      <v-list nav>
        <v-list-item>
          {{ myWidth }}
        </v-list-item>
      </v-list>
    </v-navigation-drawer>

    <v-main>
      <div>
        Mini: {{ miniVariant }}
      </div>
    </v-main>
  </div>
</template>

<script>
  export default {
    data: () => ({
      miniVariant: true,
      myWidth: 0,
      sidebar: null,
      observer: null,
    }),
    mounted () {
      this.sidebar = document.querySelector('#drawer')
      this.observer = new ResizeObserver(this.onResize)
      this.observer.observe(this.sidebar)
    },
    beforeUnmount () {
      if (this.observer) {
        this.observer.unobserve(this.sidebar)
      }
    },
    methods: {
      onResize () {
        if (this.sidebar.offsetWidth <= '56') {
          this.miniVariant = true
        } else {
          this.miniVariant = false
        }
      },
    },
  }
</script>

@johnleider johnleider added T: feature A new feature C: VNavigationDrawer VNavigationDrawer labels Dec 30, 2022
@johnleider johnleider added this to the v3.1.0 (Valkyrie) milestone Dec 30, 2022
@johnleider johnleider requested a review from a team December 30, 2022 17:03
@johnleider johnleider self-assigned this Dec 30, 2022
@johnleider johnleider merged commit 22f591b into dev Jan 3, 2023
@johnleider johnleider deleted the feat/16022-navigation-drawer-rail-model branch January 3, 2023 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VNavigationDrawer VNavigationDrawer T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant