diff --git a/.changeset/beige-coins-argue.md b/.changeset/beige-coins-argue.md new file mode 100644 index 0000000000..2a33ed620b --- /dev/null +++ b/.changeset/beige-coins-argue.md @@ -0,0 +1,5 @@ +--- +'@storefront-ui/vue': patch +--- + +fix typings of SfScrollable drag prop diff --git a/apps/docs/components/.vuepress/public/thumbnails/blocks/ProductSlider.png b/apps/docs/components/.vuepress/public/thumbnails/blocks/ProductSlider.png new file mode 100644 index 0000000000..a7441293c2 Binary files /dev/null and b/apps/docs/components/.vuepress/public/thumbnails/blocks/ProductSlider.png differ diff --git a/apps/docs/components/blocks/ProductSlider.md b/apps/docs/components/blocks/ProductSlider.md new file mode 100644 index 0000000000..7ae644084b --- /dev/null +++ b/apps/docs/components/blocks/ProductSlider.md @@ -0,0 +1,34 @@ +--- +layout: DefaultLayout +hideBreadcrumbs: true +description: The ProductSlider allows for scrollable content with product cards, providing a visually appealing and interactive way to showcase products. +hideToc: true +--- +# ProductSlider + +::: warning This is an experimental block +This block has been built on top of experimental base component. The API and structure of it might change based on user feedback. +::: + +The example allows for scrollable content with product cards, providing a visually appealing and interactive way to showcase products. + +## Basic + +Users can easily navigate through the cards by swiping or using navigation arrows, making it convenient to explore a collection of products within a limited space. The component is responsive and adapts to different devices, ensuring a consistent and enjoyable browsing experience. + +For further customization options, please refer to our documentation on the [Scrollable](/vuereact/components/scrollable.html) component and [Product Card](/vuereact/blocks/ProductCard.html) block pages. + + + + +<<<../../preview/nuxt/pages/showcases/ProductSlider/Basic.vue + + +<<<../../preview/next/pages/showcases/ProductSlider/Basic.tsx#source + + + + +## Accessibility notes + +The ProductSlider supports the use of the keyboard (Tab/alt+Tab) to navigate through images. diff --git a/apps/docs/components/blocks/Review.md b/apps/docs/components/blocks/Review.md index 793dcd9013..c72a5e3336 100644 --- a/apps/docs/components/blocks/Review.md +++ b/apps/docs/components/blocks/Review.md @@ -10,7 +10,7 @@ hideToc: true ## With Avatar -Basic Review usage with avatar and [Rating](/vue/components/rating.html) base component. +Basic Review usage with avatar and [Rating](/vuereact/components/rating.html) base component. diff --git a/apps/preview/next/pages/showcases/ProductSlider/Basic.tsx b/apps/preview/next/pages/showcases/ProductSlider/Basic.tsx new file mode 100644 index 0000000000..5950c3dc74 --- /dev/null +++ b/apps/preview/next/pages/showcases/ProductSlider/Basic.tsx @@ -0,0 +1,110 @@ +/* eslint-disable react/no-array-index-key */ +/* eslint-disable jsx-a11y/anchor-has-content */ +import { ShowcasePageLayout } from '../../showcases'; + +// #region source +import { + SfLink, + SfButton, + SfIconFavorite, + SfIconChevronLeft, + SfIconChevronRight, + SfScrollable, +} from '@storefront-ui/react'; +import classNames from 'classnames'; + +const products = Array.from(Array(10), (_, i) => ({ + id: i.toString(), + name: 'Athletic mens walking sneakers', + price: '$2,345.99', + img: { + src: 'http://localhost:3100/@assets/sneakers.png', + alt: 'White sneaker shoe', + }, +})); + +function ButtonPrev({ disabled, ...attributes }: { disabled?: boolean }) { + return ( + + ); +} + +ButtonPrev.defaultProps = { disabled: false }; + +function ButtonNext({ disabled, ...attributes }: { disabled?: boolean }) { + return ( + + ); +} + +ButtonNext.defaultProps = { disabled: false }; + +export default function GalleryVertical() { + return ( + } + slotNextButton={} + > + {products.map(({ id, name, price, img }) => ( +
+
+ + {img.alt} + + + + +
+
+ + {name} + + {price} +
+
+ ))} +
+ ); +} +// #endregion source + +GalleryVertical.getLayout = ShowcasePageLayout; diff --git a/apps/preview/nuxt/pages/showcases/ProductSlider/Basic.vue b/apps/preview/nuxt/pages/showcases/ProductSlider/Basic.vue new file mode 100644 index 0000000000..3b0d9dba10 --- /dev/null +++ b/apps/preview/nuxt/pages/showcases/ProductSlider/Basic.vue @@ -0,0 +1,84 @@ + + + diff --git a/packages/sfui/frameworks/vue/components/SfScrollable/SfScrollable.vue b/packages/sfui/frameworks/vue/components/SfScrollable/SfScrollable.vue index 3c8a3ed219..22d4c56dcc 100644 --- a/packages/sfui/frameworks/vue/components/SfScrollable/SfScrollable.vue +++ b/packages/sfui/frameworks/vue/components/SfScrollable/SfScrollable.vue @@ -44,7 +44,7 @@ const props = defineProps({ default: undefined, }, drag: { - type: [Object || Boolean] as PropType, + type: [Object, Boolean] as PropType, default: undefined, }, prevDisabled: {