@faststore/core 0.3.16 → 2.0.65-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.storybook/storybook.css +1 -0
  2. package/.turbo/turbo-build.log +50 -0
  3. package/.turbo/turbo-lint.log +2 -0
  4. package/@generated/graphql/index.ts +27 -3
  5. package/@generated/graphql/persisted.json +1 -1
  6. package/CHANGELOG.md +127 -169
  7. package/README.md +2 -2
  8. package/cypress/integration/analytics.test.js +4 -4
  9. package/cypress/integration/cart.test.js +2 -2
  10. package/cypress/integration/plp.test.js +9 -9
  11. package/package.json +9 -10
  12. package/src/Layout.tsx +7 -2
  13. package/src/components/cart/CartItem/CartItem.tsx +30 -71
  14. package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
  15. package/src/components/cart/CartSidebar/CartSidebar.tsx +13 -17
  16. package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
  17. package/src/components/common/Alert/Alert.tsx +6 -22
  18. package/src/components/common/Footer/Footer.stories.mdx +1 -1
  19. package/src/components/common/Footer/Footer.tsx +5 -38
  20. package/src/components/common/Footer/FooterFlags.tsx +23 -0
  21. package/src/components/common/Footer/FooterLinks.tsx +16 -12
  22. package/src/components/common/Footer/footer.module.scss +2 -28
  23. package/src/components/common/Footer/index.ts +1 -0
  24. package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
  25. package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
  26. package/src/components/common/Navbar/Navbar.tsx +1 -1
  27. package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
  28. package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
  29. package/src/components/common/Toast/Toast.tsx +1 -1
  30. package/src/components/product/ProductCard/ProductCard.tsx +44 -59
  31. package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
  32. package/src/components/regionalization/Regionalization.stories.mdx +24 -6
  33. package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
  34. package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
  35. package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
  36. package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
  37. package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
  38. package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
  39. package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
  40. package/src/components/search/Filter/Facets.stories.mdx +10 -10
  41. package/src/components/search/Filter/Facets.tsx +69 -61
  42. package/src/components/search/Filter/Filter.stories.mdx +1 -1
  43. package/src/components/search/Filter/Filter.tsx +1 -1
  44. package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
  45. package/src/components/search/Filter/FilterSlider.tsx +2 -2
  46. package/src/components/search/Filter/facets.module.scss +16 -16
  47. package/src/components/search/Search.stories.mdx +28 -24
  48. package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
  49. package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
  50. package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
  51. package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
  52. package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
  53. package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
  54. package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
  55. package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
  56. package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
  57. package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
  58. package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
  59. package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
  60. package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
  61. package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
  62. package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
  63. package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
  64. package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
  65. package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
  66. package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
  67. package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
  68. package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
  69. package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
  70. package/src/components/ui/Gift/Gift.tsx +18 -27
  71. package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
  72. package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
  73. package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
  74. package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
  75. package/src/components/ui/Tiles/tiles.module.scss +11 -13
  76. package/src/components/ui/Toast/Toast.stories.mdx +1 -1
  77. package/src/components/ui/Toast/Toast.tsx +1 -1
  78. package/src/pages/_app.tsx +1 -1
  79. package/src/sdk/cart/index.ts +5 -0
  80. package/src/sdk/cart/useBuyButton.ts +1 -1
  81. package/src/sdk/cart/useCartToggleButton.ts +1 -1
  82. package/src/styles/vendors/include-media.scss +1 -1
  83. package/tsconfig.json +4 -6
  84. package/.eslintrc.json +0 -3
  85. package/.github/CODEOWNERS +0 -2
  86. package/.github/workflows/release.yml +0 -42
  87. package/.release-it.json +0 -32
  88. package/src/components/cart/CartItem/cart-item.module.scss +0 -68
  89. package/src/components/product/ProductCard/product-card.module.scss +0 -254
  90. package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
  91. package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
  92. package/src/components/skeletons/Shimmer/index.ts +0 -1
  93. package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
  94. package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
  95. package/src/components/skeletons/Skeleton/index.ts +0 -1
  96. package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
  97. package/src/components/skeletons/Skeletons.stories.mdx +0 -177
  98. package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
  99. package/src/components/ui/Accordion/Accordion.tsx +0 -39
  100. package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
  101. package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
  102. package/src/components/ui/Accordion/accordion.module.scss +0 -65
  103. package/src/components/ui/Accordion/index.ts +0 -2
  104. package/src/components/ui/Alert/Alert.stories.mdx +0 -164
  105. package/src/components/ui/Alert/Alert.tsx +0 -81
  106. package/src/components/ui/Alert/alert.module.scss +0 -93
  107. package/src/components/ui/Alert/index.ts +0 -1
  108. package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
  109. package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
  110. package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
  111. package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
  112. package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
  113. package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
  114. package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
  115. package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
  116. package/src/components/ui/Dropdown/index.ts +0 -4
  117. package/src/components/ui/Gift/Gift.stories.mdx +0 -99
  118. package/src/components/ui/Gift/gift.module.scss +0 -94
  119. package/src/components/ui/Modal/Modal.stories.mdx +0 -144
  120. package/src/components/ui/Modal/Modal.tsx +0 -43
  121. package/src/components/ui/Modal/index.ts +0 -1
  122. package/src/components/ui/Modal/modal.module.scss +0 -46
  123. package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
  124. package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
  125. package/src/components/ui/PriceRange/index.ts +0 -1
  126. package/src/components/ui/PriceRange/price-range.module.scss +0 -176
  127. package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
  128. package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
  129. package/src/components/ui/ProductTitle/index.ts +0 -1
  130. package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
  131. package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
  132. package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
  133. package/src/components/ui/QuantitySelector/index.ts +0 -1
  134. package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
  135. package/src/sdk/ui/Provider.tsx +0 -151
  136. package/src/sdk/ui/useFadeEffect.ts +0 -21
@@ -39,7 +39,7 @@ The loading placeholder for the <code>ProductCard</code> used in several section
39
39
 
40
40
  ## Overview
41
41
 
42
- The `ProductCardSkeleton` component is part of [Skeletons](?path=/docs/features-skeletons-overview--usage) feature.
42
+ The `ProductCardSkeleton` component is part of Skeletons feature.
43
43
 
44
44
  ---
45
45
 
@@ -68,71 +68,13 @@ The `ProductCardSkeleton` component is part of [Skeletons](?path=/docs/features-
68
68
  token="--fs-product-card-skeleton-padding"
69
69
  value="var(--fs-spacing-1) var(--fs-spacing-1) var(--fs-spacing-2)"
70
70
  />
71
- <TokenRow
72
- token="--fs-product-card-skeleton-border-width"
73
- value="var(--fs-border-width)"
74
- />
75
- <TokenRow
76
- token="--fs-product-card-skeleton-border-color"
77
- value="transparent"
78
- isColor
79
- />
80
71
  <TokenRow
81
72
  token="--fs-product-card-skeleton-border-radius"
82
73
  value="var(--fs-border-radius)"
83
74
  />
84
- </TokenTable>
85
-
86
- ### Content
87
-
88
- <TokenTable>
89
- <TokenRow token="--fs-product-card-skeleton-content-height" value="20%" />
90
- <TokenRow
91
- token="--fs-product-card-skeleton-content-margin-top"
92
- value="var(--fs-spacing-2)"
93
- />
94
- </TokenTable>
95
-
96
- ### Button
97
-
98
- <TokenTable>
99
- <TokenRow
100
- token="--fs-product-card-skeleton-button-margin-top"
101
- value="var(--fs-spacing-4)"
102
- />
103
- </TokenTable>
104
-
105
- ### Text
106
-
107
- <TokenTable>
108
- <TokenRow
109
- token="--fs-product-card-skeleton-text-margin-bottom"
110
- value="var(--fs-product-card-skeleton-content-margin-top)"
111
- />
112
- </TokenTable>
113
-
114
- ### Badge
115
-
116
- <TokenTable>
117
- <TokenRow
118
- token="--fs-product-card-skeleton-badge-min-height"
119
- value="var(--fs-spacing-5)"
120
- />
121
- <TokenRow
122
- token="--fs-product-card-skeleton-badge-margin-top"
123
- value="var(--fs-product-card-skeleton-text-margin-top)"
124
- />
125
- <TokenRow
126
- token="--fs-product-card-skeleton-badge-max-width"
127
- value="var(--fs-product-card-skeleton-content-height)"
128
- />
129
75
  <TokenRow
130
- token="--fs-product-card-skeleton-badge-min-width-mobile"
131
- value="30%"
132
- />
133
- <TokenRow
134
- token="--fs-product-card-skeleton-badge-min-width-tablet"
135
- value="var(--fs-product-card-skeleton-content-height)"
76
+ token="--fs-product-card-skeleton-gap"
77
+ value="var(--fs-spacing-1)"
136
78
  />
137
79
  </TokenTable>
138
80
 
@@ -150,12 +92,8 @@ The `ProductCardSkeleton` component is part of [Skeletons](?path=/docs/features-
150
92
 
151
93
  <TokenTable>
152
94
  <TokenRow
153
- token="--fs-product-card-skeleton-sectioned-image-min-width"
154
- value="13rem"
155
- />
156
- <TokenRow
157
- token="--fs-product-card-skeleton-sectioned-image-height"
158
- value="var(--fs-product-card-skeleton-image-height-desktop)"
95
+ token="--fs-product-card-skeleton-sectioned-min-width"
96
+ value="10rem"
159
97
  />
160
98
  </TokenTable>
161
99
 
@@ -168,9 +106,8 @@ The `ProductCardSkeleton` component is part of [Skeletons](?path=/docs/features-
168
106
  </Canvas>
169
107
 
170
108
  <TokenTable>
171
- <TokenRow token="--fs-product-card-skeleton-bordered-mobile" value="none" />
172
109
  <TokenRow
173
- token="--fs-product-card-skeleton-bordered-desktop"
110
+ token="--fs-product-card-skeleton-bordered"
174
111
  value="var(--fs-border-width) solid var(--fs-border-color-light)"
175
112
  />
176
113
  </TokenTable>
@@ -1,5 +1,5 @@
1
- import Shimmer from '../Shimmer'
2
- import Skeleton from '../Skeleton'
1
+ import { Skeleton as UISkeleton } from '@faststore/ui'
2
+
3
3
  import styles from './product-card-skeleton.module.scss'
4
4
 
5
5
  interface ProductCardSkeletonProps {
@@ -19,12 +19,17 @@ interface ProductCardSkeletonProps {
19
19
  * Specifies the component variant.
20
20
  */
21
21
  variant?: 'default' | 'wide'
22
+ /**
23
+ * Specifies the ProductCard image's aspect ratio.
24
+ */
25
+ aspectRatio?: number
22
26
  }
23
27
 
24
28
  function ProductCardSkeleton({
25
29
  bordered,
26
30
  sectioned,
27
31
  displayButton,
32
+ aspectRatio = 1,
28
33
  variant = 'default',
29
34
  }: ProductCardSkeletonProps) {
30
35
  return (
@@ -35,16 +40,38 @@ function ProductCardSkeleton({
35
40
  data-fs-product-card-skeleton-bordered={bordered}
36
41
  data-fs-product-card-skeleton-sectioned={sectioned}
37
42
  >
38
- <div data-fs-product-card-skeleton-image>
39
- <Skeleton variant="image" />
43
+ <div
44
+ data-fs-product-card-skeleton-image
45
+ style={
46
+ {
47
+ '--fs-product-card-skeleton-image-aspect-ratio': aspectRatio,
48
+ } as React.CSSProperties
49
+ }
50
+ >
51
+ <UISkeleton size={{ width: '100%', height: '100%' }} />
40
52
  </div>
41
53
  <div data-fs-product-card-skeleton-content>
42
- <Skeleton variant="text" />
43
- <Skeleton variant="text" />
44
- <Skeleton variant="badge" />
45
- {displayButton && <Skeleton variant="button" />}
54
+ <UISkeleton
55
+ data-fs-product-card-skeleton-text
56
+ size={{ width: '90%', height: '1.5rem' }}
57
+ />
58
+ <UISkeleton
59
+ data-fs-product-card-skeleton-text
60
+ size={{ width: '70%', height: '1.5rem' }}
61
+ />
62
+ <UISkeleton
63
+ data-fs-product-card-skeleton-badge
64
+ size={{ width: '6rem', height: '2rem' }}
65
+ border="pill"
66
+ />
67
+ {displayButton && (
68
+ <UISkeleton
69
+ data-fs-product-card-skeleton-button
70
+ size={{ width: '6rem', height: '2rem' }}
71
+ style={{ columnGap: '.75rem' }}
72
+ />
73
+ )}
46
74
  </div>
47
- <Shimmer />
48
75
  </div>
49
76
  )
50
77
  }
@@ -7,34 +7,14 @@
7
7
 
8
8
  // Default properties
9
9
  --fs-product-card-skeleton-padding : var(--fs-spacing-1) var(--fs-spacing-1) var(--fs-spacing-2);
10
- --fs-product-card-skeleton-border-width : var(--fs-border-width);
11
- --fs-product-card-skeleton-border-color : transparent;
12
10
  --fs-product-card-skeleton-border-radius : var(--fs-border-radius);
13
-
14
- // Content
15
- --fs-product-card-skeleton-content-height : 20%;
16
- --fs-product-card-skeleton-content-margin-top : var(--fs-spacing-2);
17
-
18
- // Button
19
- --fs-product-card-skeleton-button-margin-top : var(--fs-spacing-4);
20
-
21
- // Text
22
- --fs-product-card-skeleton-text-margin-bottom : var(--fs-product-card-skeleton-content-margin-top);
23
-
24
- // Badge
25
- --fs-product-card-skeleton-badge-min-height : var(--fs-spacing-5);
26
- --fs-product-card-skeleton-badge-margin-top : var(--fs-product-card-skeleton-text-margin-top);
27
- --fs-product-card-skeleton-badge-max-width : var(--fs-product-card-skeleton-content-height);
28
- --fs-product-card-skeleton-badge-min-width-mobile : 30%;
29
- --fs-product-card-skeleton-badge-min-width-tablet : var(--fs-product-card-skeleton-content-height);
11
+ --fs-product-card-skeleton-gap : var(--fs-spacing-1);
30
12
 
31
13
  // Sectioned
32
- --fs-product-card-skeleton-sectioned-image-min-width : 13rem;
33
- --fs-product-card-skeleton-sectioned-image-height : 12.188rem;
14
+ --fs-product-card-skeleton-sectioned-min-width : 10rem;
34
15
 
35
16
  // Bordered
36
- --fs-product-card-skeleton-bordered-mobile : none;
37
- --fs-product-card-skeleton-bordered-desktop : var(--fs-border-width) solid var(--fs-border-color-light);
17
+ --fs-product-card-skeleton-bordered : var(--fs-border-width) solid var(--fs-border-color-light);
38
18
 
39
19
  // --------------------------------------------------------
40
20
  // Structural Styles
@@ -43,36 +23,24 @@
43
23
  position: relative;
44
24
  display: flex;
45
25
  flex-direction: column;
46
- min-width: 14vw;
47
- height: 100%;
26
+ row-gap: var(--fs-product-card-skeleton-gap);
48
27
  padding: var(--fs-product-card-skeleton-padding);
49
28
  overflow: hidden;
50
- border: var(--fs-product-card-skeleton-border-width) solid var(--fs-product-card-skeleton-border-color);
51
29
  border-radius: var(--fs-product-card-skeleton-border-radius);
52
30
 
53
- @include media(">=notebook") { min-width: 12rem; }
54
-
55
31
  [data-fs-product-card-skeleton-content] {
56
- position: relative;
57
- height: var(--fs-product-card-skeleton-content-height);
58
- margin-top: var(--fs-product-card-skeleton-content-margin-top);
59
-
60
- [data-fs-skeleton-variant="text"] { margin-bottom: var(--fs-product-card-skeleton-text-margin-bottom); }
61
-
62
- [data-fs-skeleton-variant="button"] { margin-top: var(--fs-product-card-skeleton-button-margin-top); }
63
-
64
- [data-fs-skeleton-variant="badge"] {
65
- min-width: var(--fs-product-card-skeleton-badge-min-width-mobile);
32
+ display: flex;
33
+ flex-direction: column;
34
+ row-gap: var(--fs-product-card-skeleton-gap);
35
+ }
66
36
 
67
- @include media(">=notebook") {
68
- min-height: var(--fs-product-card-skeleton-badge-min-height);
69
- margin-top: var(--fs-product-card-skeleton-badge-margin-top);
70
- }
37
+ [data-fs-product-card-skeleton-image] {
38
+ aspect-ratio: var(--fs-product-card-skeleton-image-aspect-ratio);
71
39
 
72
- @include media(">=tablet") {
73
- min-width: var(--fs-product-card-skeleton-badge-min-width-tablet);
74
- max-width: var(--fs-product-card-skeleton-badge-max-width);
75
- }
40
+ [data-fs-skeleton-wrapper],
41
+ [data-fs-skeleton] {
42
+ width: 100%;
43
+ height: 100%;
76
44
  }
77
45
  }
78
46
 
@@ -81,17 +49,10 @@
81
49
  // --------------------------------------------------------
82
50
 
83
51
  &[data-fs-product-card-skeleton-sectioned="true"] {
84
- [data-fs-skeleton-variant="image"] {
85
- min-width: var(--fs-product-card-skeleton-sectioned-image-min-width);
86
- min-height: var(--fs-product-card-skeleton-sectioned-image-height);
87
- }
52
+ min-width: var(--fs-product-card-skeleton-sectioned-min-width);
88
53
  }
89
54
 
90
55
  &[data-fs-product-card-skeleton-bordered="true"] {
91
- border: var(--fs-product-card-skeleton-bordered-mobile);
92
-
93
- @include media(">=notebook") {
94
- border: var(--fs-product-card-skeleton-bordered-desktop);
95
- }
56
+ border: var(--fs-product-card-skeleton-bordered);
96
57
  }
97
58
  }
@@ -7,17 +7,19 @@ import ProductCardSkeleton from '../ProductCardSkeleton'
7
7
 
8
8
  interface ProductGridSkeletonProps {
9
9
  loading?: boolean
10
+ aspectRatio?: number
10
11
  }
11
12
 
12
13
  function ProductGridSkeleton({
13
14
  children,
15
+ aspectRatio,
14
16
  loading = true,
15
17
  }: PropsWithChildren<ProductGridSkeletonProps>) {
16
18
  return loading ? (
17
19
  <ul className={styles.fsProductGrid}>
18
20
  {Array.from({ length: ITEMS_PER_PAGE }, (_, index) => (
19
21
  <li key={String(index)}>
20
- <ProductCardSkeleton bordered />
22
+ <ProductCardSkeleton aspectRatio={aspectRatio} bordered />
21
23
  </li>
22
24
  ))}
23
25
  </ul>
@@ -7,10 +7,12 @@ import ProductCardSkeleton from '../ProductCardSkeleton'
7
7
 
8
8
  interface Props {
9
9
  loading?: boolean
10
+ aspectRatio?: number
10
11
  }
11
12
 
12
13
  function ProductShelfSkeleton({
13
14
  children,
15
+ aspectRatio,
14
16
  loading = true,
15
17
  }: PropsWithChildren<Props>) {
16
18
  return loading ? (
@@ -20,7 +22,7 @@ function ProductShelfSkeleton({
20
22
  >
21
23
  {Array.from({ length: ITEMS_PER_SECTION }, (_, index) => (
22
24
  <li key={String(index)}>
23
- <ProductCardSkeleton sectioned />
25
+ <ProductCardSkeleton aspectRatio={aspectRatio} sectioned />
24
26
  </li>
25
27
  ))}
26
28
  </ul>
@@ -1,44 +1,46 @@
1
- import Skeleton from 'src/components/skeletons/Skeleton'
2
- import Shimmer from 'src/components/skeletons/Shimmer'
1
+ import { Skeleton as UISkeleton } from '@faststore/ui'
3
2
 
4
3
  import styles from './product-tile-skeleton.module.scss'
5
4
 
6
5
  interface ProductTileSkeletonProps {
7
6
  index: number
8
- bordered?: boolean
9
- variant?: 'wide' | 'default'
7
+ aspectRatio?: number
10
8
  }
11
9
 
12
10
  function ProductTileSkeleton({
13
11
  index,
14
- bordered,
15
- variant = 'default',
12
+ aspectRatio = 1,
16
13
  }: ProductTileSkeletonProps) {
17
14
  return (
18
15
  <div
19
16
  data-fs-product-tile-skeleton
20
17
  className={styles.fsProductTileSkeleton}
21
18
  data-fs-product-tile-skeleton-index={index}
22
- data-fs-product-tile-skeleton-variant={variant}
23
- data-fs-product-tile-skeleton-bordered={bordered}
24
19
  >
25
20
  <div
26
21
  data-fs-product-tile-skeleton-image
27
22
  data-fs-product-tile-skeleton-index={index}
23
+ style={
24
+ {
25
+ '--fs-product-tile-skeleton-image-aspect-ratio': aspectRatio,
26
+ } as React.CSSProperties
27
+ }
28
28
  >
29
- <Skeleton variant="image" />
29
+ <UISkeleton size={{ width: 'auto', height: '100%' }} loading={true} />
30
30
  </div>
31
31
  <div
32
32
  data-fs-product-tile-skeleton-content
33
33
  data-fs-product-tile-skeleton-index={index}
34
34
  >
35
- <div
36
- data-fs-product-tile-skeleton-text
37
- data-fs-product-tile-skeleton-index={index}
38
- >
39
- <Skeleton variant="text" />
35
+ <div data-fs-product-tile-skeleton-heading>
36
+ <div
37
+ data-fs-product-tile-skeleton-text
38
+ data-fs-product-tile-skeleton-index={index}
39
+ >
40
+ <UISkeleton size={{ width: '70%', height: '1.5rem' }} />
41
+ </div>
40
42
  <div data-fs-product-tile-skeleton-price>
41
- <Skeleton variant="text" />
43
+ <UISkeleton size={{ width: '60%', height: '1.5rem' }} />
42
44
  </div>
43
45
  </div>
44
46
 
@@ -46,10 +48,9 @@ function ProductTileSkeleton({
46
48
  data-fs-product-tile-skeleton-badge
47
49
  data-fs-product-tile-skeleton-index={index}
48
50
  >
49
- <Skeleton variant="badge" />
51
+ <UISkeleton size={{ width: '6rem', height: '2rem' }} border="pill" />
50
52
  </div>
51
53
  </div>
52
- <Shimmer />
53
54
  </div>
54
55
  )
55
56
  }
@@ -5,37 +5,11 @@
5
5
  // Design Tokens for Product Tile Skeleton
6
6
  // --------------------------------------------------------
7
7
 
8
- // Image
9
- --fs-product-tile-skeleton-image-height-mobile : 60%;
10
- --fs-product-tile-skeleton-image-min-height-mobile : var(--fs-product-tile-skeleton-image-height-mobile);
11
- --fs-product-tile-skeleton-image-height-tablet : 70%;
12
- --fs-product-tile-skeleton-image-min-height-tablet : var(--fs-product-tile-skeleton-image-height-tablet);
13
- --fs-product-tile-skeleton-image-height-desktop : 80%;
14
- --fs-product-tile-skeleton-image-min-height-desktop : var(--fs-product-tile-skeleton-image-height-desktop);
15
- --fs-product-tile-skeleton-image-border-radius : var(--fs-border-radius) var(--fs-border-radius) 0 0;
8
+ // Default properties
9
+ --fs-product-tile-skeleton-gap : var(--fs-spacing-1);
16
10
 
17
11
  // Content
18
- --fs-product-tile-skeleton-content-height-mobile : 40%;
19
- --fs-product-tile-skeleton-content-height-tablet : 30%;
20
- --fs-product-tile-skeleton-content-height-desktop : 20%;
21
12
  --fs-product-tile-skeleton-content-padding : var(--fs-spacing-3);
22
- --fs-product-tile-skeleton-content-border-bottom-left-radius : var(--fs-border-radius);
23
- --fs-product-tile-skeleton-content-border-bottom-right-radius : var(--fs-product-tile-skeleton-content-border-bottom-left-radius);
24
-
25
- // Text
26
- --fs-product-tile-skeleton-text-width-mobile : 70%;
27
- --fs-product-tile-skeleton-text-width-tablet : 50%;
28
- --fs-product-tile-skeleton-text-width-desktop : 60%;
29
- --fs-product-tile-skeleton-text-margin-bottom : var(--fs-spacing-1);
30
-
31
- // Price
32
- --fs-product-tile-skeleton-price-width-mobile : 60%;
33
- --fs-product-tile-skeleton-price-width-tablet : 100%;
34
-
35
- // Badge
36
- --fs-product-tile-skeleton-badge-width-mobile : 20%;
37
- --fs-product-tile-skeleton-badge-width-tablet : var(--fs-product-tile-skeleton-badge-width-mobile);
38
- --fs-product-tile-skeleton-badge-position-right : var(--fs-product-tile-skeleton-text-margin-bottom);
39
13
 
40
14
  // Wide
41
15
  --fs-product-tile-skeleton-wide-padding : var(--fs-spacing-2) var(--fs-spacing-3) var(--fs-spacing-3);
@@ -46,173 +20,62 @@
46
20
  // --------------------------------------------------------
47
21
 
48
22
  position: relative;
23
+ display: flex;
24
+ flex-direction: column;
49
25
  width: 100%;
50
26
  height: 100%;
51
27
  padding: 0;
52
28
  overflow: hidden;
53
29
 
54
- &[data-fs-product-tile-skeleton-index="1"] {
55
- min-width: 9rem;
56
- height: 24rem;
57
-
58
- @include media(">=tablet") { height: 28rem; }
30
+ @include media(">=tablet") {
31
+ display: grid;
32
+ grid-auto-rows: 62% auto;
33
+ [data-fs-product-card-image] { height: 100%; }
59
34
  }
60
35
 
61
- [data-fs-product-tile-skeleton-image] {
62
- height: var(--fs-product-tile-skeleton-image-height-mobile);
63
- min-height: var(--fs-product-tile-skeleton-image-min-height-mobile);
64
- border-radius: var(--fs-product-tile-skeleton-image-border-radius);
65
-
66
- @include media(">=tablet") {
67
- height: var(--fs-product-tile-skeleton-image-height-tablet);
68
- min-height: var(--fs-product-tile-skeleton-image-min-height-tablet);
69
- }
70
-
71
- @include media(">=notebook") {
72
- height: var(--fs-product-tile-skeleton-image-height-desktop);
73
- min-height: var(--fs-product-tile-skeleton-image-min-height-desktop);
74
- }
75
-
76
- &[data-fs-product-tile-skeleton-index="1"] {
77
- height: 80%;
78
-
79
- @include media(">=tablet") {
80
- height: 70%;
81
- min-height: 70%;
82
- }
83
-
84
- @include media(">=notebook") {
85
- height: 80%;
86
- min-height: 80%;
87
- }
88
- }
89
-
90
- [data-fs-skeleton-wrapper] { height: 100%; }
91
-
92
- [data-fs-skeleton-variant="image"] {
93
- width: 100%;
94
- height: 100%;
95
- border-bottom-right-radius: 0;
96
- border-bottom-left-radius: 0;
97
- }
98
- }
36
+ @include media(">=notebook") { grid-auto-rows: 80% auto; }
99
37
 
100
38
  [data-fs-product-tile-skeleton-content] {
101
39
  display: flex;
102
- flex-direction: row;
103
- align-items: flex-start;
104
- height: var(--fs-product-tile-skeleton-content-height-mobile);
40
+ flex-direction: column;
41
+ row-gap: var(--fs-product-tile-skeleton-gap);
105
42
  padding: var(--fs-product-tile-skeleton-content-padding);
106
- border-bottom-right-radius: var(--fs-product-tile-skeleton-content-border-bottom-right-radius);
107
- border-bottom-left-radius: var(--fs-product-tile-skeleton-content-border-bottom-left-radius);
108
-
109
- @include media(">=tablet") {
110
- flex-flow: row wrap;
111
- height: var(--fs-product-tile-skeleton-content-height-tablet);
112
- }
43
+ background-color: var(--fs-product-tile-skeleton-wide-bkg-color);
113
44
 
114
45
  @include media(">=notebook") {
115
- flex-flow: row wrap;
116
- height: var(--fs-product-tile-skeleton-content-height-desktop);
117
- }
118
-
119
- &[data-fs-product-tile-skeleton-index="1"] {
120
- height: 20%;
121
- padding: var(--fs-spacing-2) var(--fs-spacing-3);
122
-
123
- @include media(">=tablet") {
124
- flex-flow: row wrap;
125
- height: 30%;
126
- }
127
-
128
- @include media(">=notebook") { height: 20%; }
46
+ flex-direction: row;
47
+ justify-content: space-between;
48
+ height: 100%;
129
49
  }
50
+ }
130
51
 
131
- [data-fs-product-tile-skeleton-text] {
132
- width: var(--fs-product-tile-skeleton-text-width-mobile);
133
-
134
- @include media(">=tablet") {
135
- width: var(--fs-product-tile-skeleton-text-width-tablet);
136
-
137
- &[data-fs-product-tile-skeleton-index="2"],
138
- &[data-fs-product-tile-skeleton-index="3"] { width: 100%; }
139
- }
140
-
141
- @include media(">=notebook") {
142
- width: var(--fs-product-tile-skeleton-text-width-desktop);
143
-
144
- &[data-fs-product-tile-skeleton-index="2"],
145
- &[data-fs-product-tile-skeleton-index="3"] { width: 60%; }
146
- }
52
+ [data-fs-product-tile-skeleton-heading] {
53
+ display: flex;
54
+ flex-direction: column;
55
+ row-gap: var(--fs-product-tile-skeleton-gap);
56
+ width: 100%;
57
+ }
147
58
 
148
- [data-fs-skeleton-variant="text"] {
149
- margin-bottom: var(--fs-product-tile-skeleton-text-margin-bottom);
150
- }
59
+ [data-fs-product-tile-skeleton-badge] {
60
+ max-width: 100%;
61
+ }
151
62
 
152
- [data-fs-product-tile-skeleton-price] {
153
- width: var(--fs-product-tile-skeleton-price-width-mobile);
63
+ [data-fs-product-tile-skeleton-image] {
64
+ width: 100%;
65
+ aspect-ratio: var(--fs-product-tile-skeleton-image-aspect-ratio);
66
+ overflow: hidden;
154
67
 
155
- @include media(">=tablet") { width: var(--fs-product-tile-skeleton-price-width-tablet); }
156
- }
157
- }
68
+ [data-fs-skeleton-variant="image"] { border-radius: 0; }
158
69
 
159
- [data-fs-product-tile-skeleton-badge] {
160
- position: absolute;
161
- right: var(--fs-product-tile-skeleton-badge-position-right);
162
- width: var(--fs-product-tile-skeleton-badge-width-mobile);
163
-
164
- @include media(">=tablet") { width: var(--fs-product-tile-skeleton-badge-width-tablet); }
165
-
166
- &[data-fs-product-tile-skeleton-index="2"],
167
- &[data-fs-product-tile-skeleton-index="3"] {
168
- bottom: var(--fs-spacing-2);
169
- left: var(--fs-spacing-3);
170
- width: 30%;
171
-
172
- @include media(">=tablet") {
173
- position: relative;
174
- bottom: 0;
175
- left: var(--fs-spacing-2);
176
- width: 50%;
177
- }
178
-
179
- @include media(">=notebook") {
180
- position: absolute;
181
- right: var(--fs-spacing-1);
182
- bottom: unset;
183
- left: unset;
184
- width: 30%;
185
- }
186
- }
187
-
188
- [data-fs-skeleton-variant="badge"] {
189
- width: 100%;
190
- height: var(--fs-spacing-4);
191
-
192
- @include media(">=tablet") {
193
- position: absolute;
194
- right: var(--fs-spacing-1);
195
- }
196
-
197
- @include media(">=notebook") {
198
- position: relative;
199
- right: var(--fs-spacing-0);
200
- }
201
- }
202
- }
70
+ @include media(">=tablet") { height: 100%; }
203
71
  }
204
72
 
205
- // --------------------------------------------------------
206
- // Variants Styles
207
- // --------------------------------------------------------
208
-
209
- &[data-fs-product-tile-skeleton-variant="wide"] {
210
- [data-fs-product-tile-skeleton-content] {
211
- background-color: var(--fs-product-tile-skeleton-wide-bkg-color);
212
-
213
- @include media(">=tablet") {
214
- padding: var(--fs-product-tile-skeleton-wide-padding);
215
- }
73
+ [data-fs-product-tile-skeleton-image],
74
+ [data-fs-product-tile-skeleton-badge] {
75
+ [data-fs-skeleton-wrapper],
76
+ [data-fs-skeleton] {
77
+ width: 100%;
78
+ height: 100%;
216
79
  }
217
80
  }
218
81
  }