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(VSnackbar): add new properties and improve md2 spec #11542

Merged
merged 13 commits into from
Jun 3, 2020

Conversation

johnleider
Copy link
Member

@johnleider johnleider commented Jun 1, 2020

added support for elevation, rounded, and theme

Description

Changed the default value for timeout from 6000 to 5000 to match specification. Changed the value to disable the timeout from 0 to -1. The timeout property now accepts strings and is converted using Number.

Added new scoped slot that provides attributes for v-btn styling.

<template>
  <v-snackbar>
      This item already has the label "travel". You can add a new label. You can add a new label.

      <template v-slot:action="{ attrs }">
        <v-btn
          v-bind="attrs"
          text
        >
          Add a new label
        </v-btn>
      </template>
    </v-snackbar>
</template>

Added and deprecated multiple SASS variables.

  • $snackbar-font-size
  • $snackbar-btn-margin-left
  • $snackbar-btn-margin-right
  • $snackbar-content-first-btn-margin
  • $snackbar-corner-offset
  • $snackbar-wrapper-max-width
  • $snackbar-wrapper-min-width

Added the following new props:

  • centered - centers the snackbar on the x and y axis
  • content-class
  • dark
  • elevation
  • light
  • outlined
  • shaped
  • rounded
  • text
  • transition

Also refactored all tests.

Motivation and Context

Improve v-snackbar heading into LTS.

fixes #10935
fixes #5865

How Has This Been Tested?

Markup:

// Paste your FULL Playground.vue here
<template>
  <div class="ma-12 pa-12">
    <v-btn @click="value = !value">Click me</v-btn>

    <v-snackbar
      :value="value"
      timeout="-1"
      shaped
      top
      multi-line
      left
    >
      This item already has the label "travel". You can add a new label. You can add a new label.

      <template v-slot:action="{ attrs }">
        <v-btn
          v-bind="attrs"
          text
        >
          Add a new label
        </v-btn>

        <v-btn
          class="ml-2"
          icon
        >
          <v-icon>$close</v-icon>
        </v-btn>
      </template>
    </v-snackbar>

    <v-snackbar
      :value="value"
      timeout="-1"
      color="error"
      vertical
      centered
      outlined
    >
      This item already has the label.

      <template v-slot:action="{ attrs }">
        <v-btn
          v-bind="attrs"
          text
        >
          Add a new label
        </v-btn>

        <v-btn
          class="ml-2"
          icon
        >
          <v-icon>$close</v-icon>
        </v-btn>
      </template>
    </v-snackbar>

    <v-snackbar
      :value="value"
      timeout="-1"
      color="primary"
      vertical
      text
    >
      This item already has the label "travel". You can add a new label.

      <template v-slot:action="{ attrs, on }">
        <v-btn
          v-bind="attrs"
          text
        >
          Add a new label
        </v-btn>

        <v-btn
          class="ml-2"
          icon
          v-on="on"
        >
          <v-icon>$close</v-icon>
        </v-btn>
      </template>
    </v-snackbar>

    <!-- <v-navigation-drawer
      :value="value"
      app
    ></v-navigation-drawer> -->
  </div>
</template>

<script>
  export default {
    data: () => ({
      value: true,
    }),

    mounted () {
      // setInterval(() => {
      //   this.value = !this.value
      // }, 3000)
    },
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

@johnleider johnleider added this to the v2.3.0 milestone Jun 1, 2020
@johnleider johnleider self-assigned this Jun 1, 2020
@johnleider johnleider added C: VSnackbar VSnackbar T: bug Functionality that does not work as intended/expected T: feature A new feature labels Jun 1, 2020
@johnleider johnleider requested review from a team June 1, 2020 22:13
@johnleider
Copy link
Member Author

Requesting Initial comments from @vuetifyjs/contributors @vuetifyjs/core-team

@TravisBuddy
Copy link

TravisBuddy commented Jun 2, 2020

Hey @johnleider,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: 13c9d410-a5b1-11ea-84d7-9d6761bd5292

@johnleider johnleider force-pushed the feat/snackbar-improvements branch 2 times, most recently from 6c869ee to 2aae2c2 Compare June 2, 2020 02:28
@nekosaur

This comment has been minimized.

@KaelWD

This comment has been minimized.

@johnleider
Copy link
Member Author

Requesting Final comments from @vuetifyjs/contributors @vuetifyjs/core-team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VSnackbar VSnackbar T: bug Functionality that does not work as intended/expected T: feature A new feature
Projects
None yet
5 participants