Git Product home page Git Product logo

store-image's Introduction

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

Store Image

All Contributors

The Store Image app exports the list-context.image-list block, which is responsible for the image content in the store theme.

store-image

Configurating the store image

  1. Add the store-image app to your theme dependencies in the manifest.json. For example:
 "dependencies ": {
+  "vtex.store-image": "0.x"
 }

You can now use the list-context.image-list block exported by the Store Image app. The block allows you to display images in your store with more composability since you can use it along with other list-context blocks to create a more flexible and customizable image slider.

  1. In any desired theme template, add the list-context.image-list block, declaring the slider-layout a child block. For example:
  "list-context.image-list#demo": {
    "children": ["slider-layout#demo-images"],
    "props": {
      "preload": true,
      "height": 650,
      "images": [
        {
          "loading": "eager",
          "image": "https://storecomponents.vteximg.com.br/arquivos/banner-infocard2.png",
          "description": "something something"
        },
        {
          "loading": "lazy",
          "image": "https://storecomponents.vteximg.com.br/assets/vtex.file-manager-graphql/images/Group%207%20(1)%20(1)%20(1)%20(1)%20(1)___c6b3ed853fb16a08b265753b50e0c57a.png",
          "description": "something something"
        }
      ]
    }
  },

  "slider-layout#demo-images": {
    "props": {
      "itemsPerPage": {
        "desktop": 1,
        "tablet": 1,
        "phone": 1
      },
      "infinite": true
    }
  },

Note that the slider-layout block exported from the Slider Layout app is a child block of list-context.image-list. It defines which images will be displayed and their behavior when rendered.

list-context.image-list props

Prop name Type Description Default value
images array Array of objects declaring all the images to be rendered. undefined
height number Image height for all images declared in the image object (in px). undefined
preload boolean Preloads the first image in a list, prioritizing the image display over other assets. false
experimentalSetExplicitDimensions boolean Sets explicit width and/or height attributes for an image, if width and/or height props are provided in px.

image-list props

Prop name Type Description Default value
images array Array of objects declaring all the images to be rendered. undefined
height number Image height for all images declared in the image object (in px). undefined
  • images array:
Prop name Type Description Default value
image string Image URL. undefined
mobileImage string Mobile image URL. undefined
description string Image description. undefined
link object Links an URL to the image being rendered. undefined
width string / number Image width (in % or px). 100%
loading string Loading strategy, either when the page loads ('eager') or when closer to the viewport ('lazy') 'eager'
fetchpriority string The fetch priority hint ('high', 'low' or 'auto') 'auto'
analyticsProperties string Whether analytics props should be set ('provided') or not ('none') 'none'
promotionId string The ID of the promotion associated with the event. undefined
promotionName string The name of the promotion associated with the event. undefined
promotionPosition string The name of the promotional creative slot associated with the event. undefined
promotionProductId string The ID of the product associated with the event. undefined
promotionProductName string The name of the product associated with the event. undefined
  • link object:
Prop name Type Description Default value
url string URL users will be redirected when clicking the image. undefined
noFollow boolean Whether the page owner endorses the linked URL the user was navigating on, i.e., if there is a commercial relationship between both pages (true) or (false). false
openNewTab string Whether a new tab will be opened on the browser (true) or (false). undefined
title string Text label used to identify the image in the Admin Site Editor. undefined

ℹī¸ Use the Admin Site Editor to manage all images declared in the list-context.image-list block.

Customization

The block still does not have CSS handles for its specific customization.

All CSS handles available for the Image block are available for the slider-layout block. Take a look at the Customization section in the Slider Layout documentation. Note that the image-slider uses our vtex.slider-layout app, so all the CSS namespaces defined by it are also available for image-slider. See more in Slider Layout.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

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

store-image's People

Contributors

camilavcoutinho avatar carolinamenezes avatar cavaglieridomenico avatar daniserejo avatar filipewl avatar georgelimadev avatar guerreirobeatriz avatar iago1501 avatar icazevedo avatar igorbrasileiro avatar jeymisson avatar kaio-donadelli avatar kaisermann avatar klynger avatar klzns avatar lbebber avatar lucvysk avatar mariusfiliutamindcell avatar ovio224 avatar oviolion avatar polishq avatar victorhmp avatar viniciuswz avatar vitorflg avatar vsseixaso avatar

Stargazers

 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

store-image's Issues

Distorted images on stores that are already in production

The changes applied in #87 are causing images to appear distorted when they are in image lists. It appears this is happening because the height prop of the list-context.image-list is being set as the height prop for all elements in the list. If the height prop of the list is set as 500px all itens are being set with the height 500px ignoring the aspect-ratio of the element

To Reproduce
Go to any image list on editor and change the height property value, you will see when using browser inspector that the inline height value of all items are now the same you set for the list

Expected behavior
When in a list, avoid to use the height property as prop for all elements

Screenshots
image

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.