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(VSlideGroup): add show-arrows="never" #14587

Merged
merged 1 commit into from Mar 23, 2023

Conversation

bokub
Copy link
Contributor

@bokub bokub commented Jan 10, 2022

Description

In VSlideGroup, when the show-arrows prop is false, always hide the arrows. When not set (=== undefined), keep the default behaviour.

Fixes #14586

Motivation and Context

There was no way to hide the arrows completely, even with :show-arrows="false"

How Has This Been Tested?

With Playground.vue, both on Desktop and mobile:

Desktop:

image

Mobile:

image

Markup:

<template>
  <v-container>

    <pre class="mx-2">:show-arrows="false"</pre>
    <v-slide-group
      class="pa-4"
      center-active
      :show-arrows="false"
    >
      <v-slide-item
        v-for="n in 15"
        :key="n"
        v-slot="{ active, toggle }"
      >
        <v-card
          :color="active ? 'primary' : 'grey lighten-1'"
          class="ma-4"
          height="200"
          width="100"
          @click="toggle"
        >
          <v-row
            class="fill-height"
            align="center"
            justify="center"
          >
            <v-scale-transition>
              <v-icon
                v-if="active"
                color="white"
                size="48"
                v-text="'mdi-close-circle-outline'"
              ></v-icon>
            </v-scale-transition>
          </v-row>
        </v-card>
      </v-slide-item>
    </v-slide-group>

    <pre class="mx-2">:show-arrows not set (default, same as before)</pre>
    <v-slide-group
      class="pa-4"
      center-active
    >
      <v-slide-item
        v-for="n in 15"
        :key="n"
        v-slot="{ active, toggle }"
      >
        <v-card
          :color="active ? 'primary' : 'grey lighten-1'"
          class="ma-4"
          height="200"
          width="100"
          @click="toggle"
        >
          <v-row
            class="fill-height"
            align="center"
            justify="center"
          >
            <v-scale-transition>
              <v-icon
                v-if="active"
                color="white"
                size="48"
                v-text="'mdi-close-circle-outline'"
              ></v-icon>
            </v-scale-transition>
          </v-row>
        </v-card>
      </v-slide-item>
    </v-slide-group>

    <pre class="mx-2">:show-arrows="true"</pre>
    <v-slide-group
      class="pa-4"
      center-active
      :show-arrows="true"
    >
      <v-slide-item
        v-for="n in 15"
        :key="n"
        v-slot="{ active, toggle }"
      >
        <v-card
          :color="active ? 'primary' : 'grey lighten-1'"
          class="ma-4"
          height="200"
          width="100"
          @click="toggle"
        >
          <v-row
            class="fill-height"
            align="center"
            justify="center"
          >
            <v-scale-transition>
              <v-icon
                v-if="active"
                color="white"
                size="48"
                v-text="'mdi-close-circle-outline'"
              ></v-icon>
            </v-scale-transition>
          </v-row>
        </v-card>
      </v-slide-item>
    </v-slide-group>
  </v-container>
</template>

<script>
  export default {
    data: () => ({
    }),
  }
</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)

Copy link
Member

@KaelWD KaelWD left a comment

Choose a reason for hiding this comment

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

This is a breaking change, I'd be ok with show-arrows="never" instead though

@bokub
Copy link
Contributor Author

bokub commented Jun 15, 2022

Sure, I'll change that !

But what is false supposed to do ? Same as undefined ?

@KaelWD
Copy link
Member

KaelWD commented Jun 15, 2022

Yes, false is the default behaviour (only show arrows on desktop + overflowing)

@bokub
Copy link
Contributor Author

bokub commented Jun 15, 2022

@KaelWD Fixed it !

New playground code:

<template>
  <v-container fluid>
    <div v-for="opt in [undefined, false, true, 'always', 'never', 'mobile', 'desktop']">
      <pre class="mx-2">show-arrows="{{ opt === undefined ? 'undefined' : opt }}"</pre>
      <v-slide-group
        class="pa-4"
        center-active
        :show-arrows="opt"
      >
        <v-slide-item
          v-for="n in 10"
          :key="n"
          v-slot="{ active, toggle }"
        >
          <v-card
            :color="active ? 'primary' : 'grey lighten-1'"
            class="ma-4"
            height="50"
            width="100"
            @click="toggle"
          >
            <v-row
              class="fill-height"
              align="center"
              justify="center"
            >
              <v-scale-transition>
                <v-icon
                  v-if="active"
                  color="white"
                  size="48"
                  v-text="'mdi-close-circle-outline'"
                ></v-icon>
              </v-scale-transition>
            </v-row>
          </v-card>
        </v-slide-item>
      </v-slide-group>
    </div>
  </v-container>
</template>

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

Screen capture:

Peek 2022-06-15 16-18

@bokub bokub changed the title fix(VSlideGroup): always hide arrows when prop is false fix(VSlideGroup): always hide arrows when prop is "never" Jun 15, 2022
@bokub bokub force-pushed the fix/14586-v-slide-group-arrows branch from 21440e1 to 196a23e Compare June 20, 2022 12:42
@bokub bokub force-pushed the fix/14586-v-slide-group-arrows branch from 196a23e to 23e4a5c Compare June 20, 2022 12:43
@KaelWD KaelWD changed the title fix(VSlideGroup): always hide arrows when prop is "never" feat(VSlideGroup): add show-arrows="never" Jun 29, 2022
@KaelWD KaelWD added this to the v2.7.0 milestone Jun 29, 2022
@KaelWD KaelWD self-assigned this Jun 29, 2022
@bokub
Copy link
Contributor Author

bokub commented Dec 8, 2022

Hello, if the code is OK with you, could you please merge this MR ?

Thanks 👍

@HaimCandiTech
Copy link

@KaelWD
Please check it out again

@KaelWD KaelWD changed the base branch from master to v2-dev December 12, 2022 11:30
@KaelWD KaelWD merged commit 354a999 into vuetifyjs:v2-dev Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][2.6.2] VSlideGroup arrows are sometimes visible when show-arrows = false
3 participants