GithubHelp home page GithubHelp logo

slider-layout's Introduction

πŸ“’ Use this project, contribute to it or open issues to help evolve it using Store Discussion.

Slider Layout

All Contributors

Slider Layout is a flexible solution for building block sliders in VTEX Store Framework, such as a carousel component.

To use the Slider layout as a substitute for the Carousel app, read the Building a Carousel through lists and Slider Layout documentation.

Google Analytics 4 Integration

Slider Layout enables you to integrate your component with Google Analytics 4. The integration happens through the GA4 view_promotion event, which is typically associated with the promotion banners carousel displayed by the Slider Layout.

By integrating with Google Analytics 4, you can set the Product ID and Product Name, and position of your promotion on Site Editor to be shown on a Google Analytics dashboard.

To set this up, go to the VTEX Admin, access Storefront > Site Editor, and open the image settings of the internal promotion you want to track. These settings are displayed on the right side of the page.

ga4-in-site-editor

For more information about managing your page content, read Managing page and template content.

After setup, Google Analytics can track your internal promotions and generate reports of their views, clicks, click-through rate, conversions, and revenue.

Configuration

  1. Add the slider-layout app to your theme dependencies in the manifest.json file:
"dependencies": {
  "vtex.slider-layout": "0.x"
}

Now, you can use all blocks exported by the slider-layout app. See the complete list below:

Block name Description
slider-layout https://img.shields.io/badge/-Mandatory-red Builds block sliders for your store through its children list blocks.
slider-layout-group Enables you to keep a group of slider-layout blocks synched with each other. For more information about this, see the Advanced configuration section below.
  1. Add the slider-layout block to your template. For example:
  "slider-layout#text-test": {
    "props": {
      "itemsPerPage": {
        "desktop": 1,
        "tablet": 1,
        "phone": 1
      },
      "infinite": true,
      "showNavigationArrows": "desktopOnly",
      "blockClass": "carousel"
    },
    "children": ["rich-text#1", "rich-text#2", "rich-text#3"]
  },

  "rich-text#1": {
    "props": {
      "text": "Test1"
    }
  },
  "rich-text#2": {
    "props": {
      "text": "Test2"
    }
  },
  "rich-text#3": {
    "props": {
      "text": "Test3"
    }
  },
Prop name Type Description Default value
label string aria-label attribute value to be used by the <Slider/> component when rendered. The aria-label value should explicitly tell users what the inspected HTML element does. slider
showNavigationArrows enum Indicates when navigation arrows should be rendered. Possible values are: mobileOnly, desktopOnly, always, or never. always
showPaginationDots enum Indicates when pagination dots should be rendered. Possible values are: mobileOnly, desktopOnly, always, or never. always
infinite boolean Determines whether the slider should be infinite (true) or not (false). When this prop is set as false, the slider will have an explicit end for users. false
usePagination boolean Determines whether the slider should use slide pages (true) or not (false). When this prop is set as false, the slider will use smooth scrolling for slide navigation instead of arrows. true
itemsPerPage object The number of slider items to be shown on each type of device. For more information about this, see the itemsPerPage object section below. { desktop: 5, tablet: 3, phone: 1 }
navigationStep number / enum The number of slider items that should be displayed when users click one of the slider arrows. It is also possible to set this prop value as page, meaning that the number of slider items to be displayed when one of the arrows is clicked is equal to the number of slider items set per page (in the itemsPerPage prop). page
slideTransition object Controls the transition animation between slides based on CSS attributes. For more information about this, see the slideTransition object section below. { speed: 400, delay: 0, timing: '' }
autoplay object Controls the autoplay feature behavior. For more information about this, see the autoplay object section below. undefined
fullWidth boolean Determines whether the slides should occupy the full page width, making the arrows appear on top of them (true) or not (false). true
arrowSize number / object Slider arrows size (height and width) in pixels. This is a responsive prop, which means you can pass to it an object with different values for each breakpoint (desktop, mobile, tablet, and phone). 25
centerMode enum / object Defines positioning of the slider elements on the screen. Possible values are: center (elements are centered, allowing users to see a peek of the previous and next slides), to-the-left (aligns elements to the left side, allowing users to see a peek of the next slide, but not the previous one), and disabled (disables the feature, rendering elements on the whole screen without showing a peek of the previous and next slides). Note: This is a responsive prop, which means you can pass to it an object with different values for each breakpoint (desktop, mobile, tablet, and phone). disabled
centerModeSlidesGap number Number of pixels between slides when centerMode is set to center or to-the-left. undefined
  • itemsPerPage object
Prop name Type Description Default value
desktop number The number of slides to be displayed on desktop devices. 5
tablet number The number of slides to be displayed on tablet devices. 3
phone number The number of slides to be displayed on phone devices. 1
  • slideTransition object
Prop name Type Description Default value
speed number Transition speed (in ms). 400
delay number Delay between slide transition (in ms). 0
timing string Timing function. ''
  • autoplay object
Prop name Type Description Default value
timeout number Timeout (in ms) between each slide. undefined
stopOnHover boolean Determines whether the autoplay should stop when users are hovering over the slider (true) or not (false). undefined

Advanced configuration

The slider-layout-group block synchronizes the slides rendered by each slider-layout block declared in it.

Therefore, the slider-layout-group does not render any specific component on the store UI. It is really a logical block that only expects to receive a children block list containing the desired slider-layout blocks that should be rendered. For example:

{
  "slider-layout-group#test": {
    "children": ["slider-layout#1", "slider-layout#2", "slider-layout#3"]
  }
}

Below, you can find a practical example using three slider-layout blocks inside of a slider-layout-group. Each slider-layout received three rich-text blocks as children to serve as individual slides:

slider-layout-group demo

⚠️ *All slider-layout blocks declared in the slider-layout-group must have the same configuration, meaning the same props and values. Due to implementation rules, they can only differ in their children block list. Keep in mind that declaring slider-layout blocks with different configurations will result in unexpected behavior, leading to errors that are not supported by the VTEX Store Framework team.*

Customization

To apply CSS customizations to this and other blocks, follow the instructions given in the recipe on Using CSS handles for store customization.

CSS handles
paginationDot--isActive
paginationDot
paginationDotsContainer
slide--firstVisible
slide--hidden
slide--lastVisible
slide--visible
slideChildrenContainer
slide
sliderArrows
sliderLayoutContainer
sliderLeftArrow
sliderRightArrow
sliderTrackContainer
sliderTrack

Contributors ✨

Thanks goes to these wonderful people:

This project follows the all-contributors specification. Contributions of any kind are welcome!

slider-layout's People

Contributors

camilavcoutinho avatar carolinamenezes avatar claudiu-iviteb avatar daniserejo avatar danzanzini avatar denisebiscaro avatar filipewl avatar georgebrindeiro avatar georgelimadev avatar guerreirobeatriz avatar icazevedo avatar igorbrasileiro avatar jayendra88 avatar joaocongio avatar kaio-donadelli avatar kaisermann avatar klzns avatar lbebber avatar marcellasiqueira avatar mariana-caetano avatar ovio224 avatar oviolion avatar pgrimaud avatar ricardo7634234 avatar saviomuniz avatar victorhmp avatar vwraposo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slider-layout's Issues

fullWidth prop not working

Describe the bug
The fullWidth prop does not work properly, follow the example below.
There is a "dib" class in a span element that I can't customize because the is not a class handle and the :first-child is not working either.

I tried to do this and its not woked:

.slideChildrenContainer--carousel :first-child { 
  width: 100%;
}

Screenshots
image

Slider layout expands on click

Describe the bug
A clear and concise description of what the bug is.
When I click on the arrows in the slider, the component expands and breaks the department page grid

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://testedepartamento--zonasul.myvtex.com/mercearia-e-gastronomia/d'
  2. Click on '....'
    image
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop environment:

Smartphone environment:

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Bug with infinite prop

Describe the bug
O slide apresenta erros quando a prop infinite estΓ‘ como false. Quando tentamos passar pro lado, o componente quebra e mostra uma parte do item novo e uma parte do anterior ou do seguinte.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Workspace teste - testar em mobile'
  2. Scroll down to 'Massimo conforto shelf'
  3. Click on 'the arrows'
  4. See error

Expected behavior
Quando clicar ele passar corretamente pelos itens

Screenshots
If applicable, add screenshots to help explain your problem.

Give useSliderState

Is your feature request related to a problem? Please describe.
I need to know the actual slider and didn't find a better way to do this with react, so I search the code in this repo and found that exist the useSliderState with currentState info, but this context is not available to use outside this code, with something like:

import { useSliderState } from "vtex.slider-layout/SliderLayout";

I was wondering if it is possible to make this adjustment to help us. Thanks!

Problem slider selector-sku in shelf with slider

    Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! πŸ€–

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

Originally posted by @vtex-io-ci-cd[bot] in #99 (comment)

[ BUG ] Problem in infinite layout with navigationStep different of itemsPerPage

[ BUG DESCRIPTION ]
When using prop infinite=true in combination with navigationStep={1} (or a different value of itemsPerPage) slider-layout app never reaches the last slide-page, furthermore the infinite behavior is breaking (Slider layout won't back to the first slide item, it's back to the previous slide when using navigationStep={1})

[ BUG VIDEO ]
https://user-images.githubusercontent.com/61763034/136204729-32985870-f244-4ec0-99fe-a6e4d2692ae2.mp4

Infinite property bug on slider in mobile view

Describe the bug
It is a bug in the vtex slider that affects the scrolling at the end of the slider in mobile view when the infinite property is set to true.
When you go to the end of the slider then you continue to scrolling, there will be an infinite scrolling even after the last slide, there will be an infinity white space if you cntinue scrolling.

To Reproduce
Steps to reproduce the behavior:

  1. Activate the Infinite property of the slider to true from the site editor
  2. Go to any slider in a store theme in mobile view and start to scrolling fast to the end, then continue scrolling.
  3. See an infinite white space created if you continue to scrolling.

Expected behavior
When finish scrolling the slider to the end, I expect to see the first slide after the last slide.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.