@faststore/core 2.0.141-alpha.0 → 2.0.142-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 (177) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +6 -0
  3. package/cms/faststore/sections.json +42 -1
  4. package/package.json +4 -4
  5. package/src/components/cart/CartToggle/CartToggle.tsx +4 -4
  6. package/src/components/cms/GlobalSections.tsx +3 -3
  7. package/src/components/navigation/Navbar/Navbar.tsx +120 -64
  8. package/src/components/navigation/Navbar/index.ts +1 -0
  9. package/src/components/navigation/NavbarLinks/NavbarLinks.tsx +20 -33
  10. package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +23 -7
  11. package/src/components/region/RegionButton/RegionButton.tsx +3 -3
  12. package/src/components/sections/Alert/index.ts +1 -0
  13. package/src/components/sections/Footer/Footer.tsx +2 -9
  14. package/src/components/sections/Navbar/Navbar.tsx +85 -0
  15. package/src/components/sections/Navbar/index.ts +2 -0
  16. package/src/components/sections/Section/Section.tsx +10 -4
  17. package/src/components/ui/Button/ButtonSignIn/ButtonSignIn.tsx +12 -3
  18. package/src/components/ui/Image/Image.tsx +3 -1
  19. package/src/components/ui/Image/index.ts +1 -0
  20. package/src/components/ui/Logo/Logo.tsx +23 -2
  21. package/src/styles/themes/midnight.scss +0 -1
  22. package/src/styles/themes/soft-blue.scss +0 -1
  23. package/.next/BUILD_ID +0 -1
  24. package/.next/build-manifest.json +0 -132
  25. package/.next/cache/.tsbuildinfo +0 -1
  26. package/.next/cache/config.json +0 -7
  27. package/.next/cache/eslint/.cache_1gneedd +0 -1
  28. package/.next/cache/next-server.js.nft.json +0 -1
  29. package/.next/cache/webpack/client-production/0.pack +0 -0
  30. package/.next/cache/webpack/client-production/index.pack +0 -0
  31. package/.next/cache/webpack/server-production/0.pack +0 -0
  32. package/.next/cache/webpack/server-production/index.pack +0 -0
  33. package/.next/export-marker.json +0 -1
  34. package/.next/images-manifest.json +0 -1
  35. package/.next/next-server.js.nft.json +0 -1
  36. package/.next/package.json +0 -1
  37. package/.next/prerender-manifest.json +0 -1
  38. package/.next/react-loadable-manifest.json +0 -48
  39. package/.next/required-server-files.json +0 -1
  40. package/.next/routes-manifest.json +0 -1
  41. package/.next/server/chunks/104.js +0 -703
  42. package/.next/server/chunks/123.js +0 -58
  43. package/.next/server/chunks/143.js +0 -106
  44. package/.next/server/chunks/183.js +0 -80
  45. package/.next/server/chunks/247.js +0 -61
  46. package/.next/server/chunks/280.js +0 -324
  47. package/.next/server/chunks/287.js +0 -58
  48. package/.next/server/chunks/312.js +0 -670
  49. package/.next/server/chunks/336.js +0 -821
  50. package/.next/server/chunks/350.js +0 -142
  51. package/.next/server/chunks/368.js +0 -253
  52. package/.next/server/chunks/401.js +0 -7241
  53. package/.next/server/chunks/431.js +0 -7241
  54. package/.next/server/chunks/502.js +0 -600
  55. package/.next/server/chunks/557.js +0 -132
  56. package/.next/server/chunks/576.js +0 -80
  57. package/.next/server/chunks/597.js +0 -169
  58. package/.next/server/chunks/608.js +0 -644
  59. package/.next/server/chunks/644.js +0 -235
  60. package/.next/server/chunks/664.js +0 -3401
  61. package/.next/server/chunks/676.js +0 -32
  62. package/.next/server/chunks/701.js +0 -87
  63. package/.next/server/chunks/74.js +0 -2520
  64. package/.next/server/chunks/746.js +0 -225
  65. package/.next/server/chunks/82.js +0 -371
  66. package/.next/server/chunks/854.js +0 -72
  67. package/.next/server/chunks/859.js +0 -959
  68. package/.next/server/chunks/874.js +0 -487
  69. package/.next/server/chunks/886.js +0 -120
  70. package/.next/server/chunks/907.js +0 -1723
  71. package/.next/server/chunks/98.js +0 -124
  72. package/.next/server/chunks/font-manifest.json +0 -1
  73. package/.next/server/font-manifest.json +0 -1
  74. package/.next/server/middleware-build-manifest.js +0 -1
  75. package/.next/server/middleware-manifest.json +0 -6
  76. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  77. package/.next/server/pages/404.js +0 -393
  78. package/.next/server/pages/404.js.nft.json +0 -1
  79. package/.next/server/pages/500.js +0 -395
  80. package/.next/server/pages/500.js.nft.json +0 -1
  81. package/.next/server/pages/[...slug].js +0 -725
  82. package/.next/server/pages/[...slug].js.nft.json +0 -1
  83. package/.next/server/pages/[slug]/p.js +0 -2386
  84. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  85. package/.next/server/pages/_app.js +0 -368
  86. package/.next/server/pages/_app.js.nft.json +0 -1
  87. package/.next/server/pages/_document.js +0 -304
  88. package/.next/server/pages/_document.js.nft.json +0 -1
  89. package/.next/server/pages/_error.js +0 -164
  90. package/.next/server/pages/_error.js.nft.json +0 -1
  91. package/.next/server/pages/account.js +0 -370
  92. package/.next/server/pages/account.js.nft.json +0 -1
  93. package/.next/server/pages/api/graphql.js +0 -315
  94. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  95. package/.next/server/pages/api/preview.js +0 -118
  96. package/.next/server/pages/api/preview.js.nft.json +0 -1
  97. package/.next/server/pages/checkout.js +0 -370
  98. package/.next/server/pages/checkout.js.nft.json +0 -1
  99. package/.next/server/pages/en-US/404.html +0 -81
  100. package/.next/server/pages/en-US/404.json +0 -1
  101. package/.next/server/pages/en-US/500.html +0 -81
  102. package/.next/server/pages/en-US/500.json +0 -1
  103. package/.next/server/pages/en-US/account.html +0 -81
  104. package/.next/server/pages/en-US/account.json +0 -1
  105. package/.next/server/pages/en-US/checkout.html +0 -81
  106. package/.next/server/pages/en-US/checkout.json +0 -1
  107. package/.next/server/pages/en-US/login.html +0 -81
  108. package/.next/server/pages/en-US/login.json +0 -1
  109. package/.next/server/pages/en-US/s.html +0 -81
  110. package/.next/server/pages/en-US/s.json +0 -1
  111. package/.next/server/pages/en-US.html +0 -81
  112. package/.next/server/pages/en-US.json +0 -1
  113. package/.next/server/pages/index.js +0 -966
  114. package/.next/server/pages/index.js.nft.json +0 -1
  115. package/.next/server/pages/login.js +0 -375
  116. package/.next/server/pages/login.js.nft.json +0 -1
  117. package/.next/server/pages/s.js +0 -457
  118. package/.next/server/pages/s.js.nft.json +0 -1
  119. package/.next/server/pages-manifest.json +0 -16
  120. package/.next/server/webpack-api-runtime.js +0 -229
  121. package/.next/server/webpack-runtime.js +0 -229
  122. package/.next/static/aYsUeJebfxFmPYaCwqdKq/_buildManifest.js +0 -1
  123. package/.next/static/aYsUeJebfxFmPYaCwqdKq/_ssgManifest.js +0 -1
  124. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  125. package/.next/static/chunks/170.c17ce564bb568265.js +0 -1
  126. package/.next/static/chunks/202-80a2f2380b08e20d.js +0 -1
  127. package/.next/static/chunks/226.b57e10ad9932f88c.js +0 -1
  128. package/.next/static/chunks/327-43715af4f3fffaf6.js +0 -1
  129. package/.next/static/chunks/336.0846f48eccce57e4.js +0 -1
  130. package/.next/static/chunks/366-4a0572a47e2225d9.js +0 -1
  131. package/.next/static/chunks/391-47b923ef44945418.js +0 -1
  132. package/.next/static/chunks/495.8ffebac98e9475dc.js +0 -1
  133. package/.next/static/chunks/502.7fd4f230c33d8eca.js +0 -1
  134. package/.next/static/chunks/545-1d3d08edfd2ee4c6.js +0 -1
  135. package/.next/static/chunks/597.c5cf3fbeae5ceb63.js +0 -1
  136. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  137. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  138. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  139. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  140. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  141. package/.next/static/chunks/pages/404-eb7e8c41c852c36d.js +0 -1
  142. package/.next/static/chunks/pages/500-7dc597fd3f74e419.js +0 -1
  143. package/.next/static/chunks/pages/[...slug]-229b8537827404bc.js +0 -1
  144. package/.next/static/chunks/pages/[slug]/p-a3a8af1949dc6eca.js +0 -1
  145. package/.next/static/chunks/pages/_app-3e4e7e579cb0681a.js +0 -1
  146. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  147. package/.next/static/chunks/pages/account-7f4c51b747b4edd0.js +0 -1
  148. package/.next/static/chunks/pages/checkout-cb8871ab88a1471f.js +0 -1
  149. package/.next/static/chunks/pages/index-7587d2684d1f1de4.js +0 -1
  150. package/.next/static/chunks/pages/login-9490b01a047906c0.js +0 -1
  151. package/.next/static/chunks/pages/s-9582cfca21ff2718.js +0 -1
  152. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  153. package/.next/static/chunks/webpack-d73d5e1e07f9bee2.js +0 -1
  154. package/.next/static/css/13a4da555ff5e3be.css +0 -1
  155. package/.next/static/css/2257f9a5bf751bf1.css +0 -1
  156. package/.next/static/css/2e00f7ba49c754b3.css +0 -1
  157. package/.next/static/css/2e9de35e0cb999e0.css +0 -1
  158. package/.next/static/css/43b1b3821e21630c.css +0 -1
  159. package/.next/static/css/48af598df5fe042d.css +0 -1
  160. package/.next/static/css/587c27bbda64e700.css +0 -1
  161. package/.next/static/css/7701d01af31e31d1.css +0 -1
  162. package/.next/static/css/e02cdad8fc000339.css +0 -1
  163. package/.next/static/css/e434797816e17065.css +0 -1
  164. package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
  165. package/.next/trace +0 -68
  166. package/public/~partytown/debug/partytown-atomics.js +0 -556
  167. package/public/~partytown/debug/partytown-media.js +0 -374
  168. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  169. package/public/~partytown/debug/partytown-sw.js +0 -59
  170. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  171. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  172. package/public/~partytown/debug/partytown.js +0 -72
  173. package/public/~partytown/partytown-atomics.js +0 -2
  174. package/public/~partytown/partytown-media.js +0 -2
  175. package/public/~partytown/partytown-sw.js +0 -2
  176. package/public/~partytown/partytown.js +0 -2
  177. /package/src/components/{navigation → sections}/Navbar/section.module.scss +0 -0
@@ -26,7 +26,7 @@ Route (pages) Size First Load JS
26
26
  ┌ ● / 2.97 kB 126 kB
27
27
  ├ └ css/13a4da555ff5e3be.css 7.19 kB
28
28
  ├ /_app 0 B 77.9 kB
29
- ├ ● /[...slug] 10 kB 132 kB
29
+ ├ ● /[...slug] 10 kB 133 kB
30
30
  ├ └ css/2e9de35e0cb999e0.css 7.9 kB
31
31
  ├ ● /[slug]/p 11.4 kB 134 kB
32
32
  ├ └ css/7701d01af31e31d1.css 10.9 kB
@@ -37,13 +37,13 @@ Route (pages) Size First Load JS
37
37
  ├ λ /api/preview 0 B 77.9 kB
38
38
  ├ ● /checkout 659 B 113 kB
39
39
  ├ ● /login 1.01 kB 113 kB
40
- └ ● /s 994 B 123 kB
40
+ └ ● /s 995 B 124 kB
41
41
  + First Load JS shared by all 80.7 kB
42
42
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
43
43
  ├ chunks/main-fd466221927468fd.js 23.9 kB
44
44
  ├ chunks/pages/_app-3e4e7e579cb0681a.js 6.43 kB
45
- ├ chunks/webpack-d73d5e1e07f9bee2.js 2.27 kB
46
- └ css/587c27bbda64e700.css 2.8 kB
45
+ ├ chunks/webpack-3c331de8004e61a7.js 2.27 kB
46
+ └ css/923c4a942e57bc91.css 2.81 kB
47
47
 
48
48
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
49
49
  ○ (Static) automatically rendered as static HTML (uses no initial props)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.142-alpha.0](https://github.com/vtex/faststore/compare/v2.0.141-alpha.0...v2.0.142-alpha.0) (2023-05-16)
7
+
8
+ ### Features
9
+
10
+ - Adjust `Navbar` for CMS ([#1756](https://github.com/vtex/faststore/issues/1756)) ([105a8b2](https://github.com/vtex/faststore/commit/105a8b2f69ffd8438532d7c9eb959ed26a567675))
11
+
6
12
  ## [2.0.141-alpha.0](https://github.com/vtex/faststore/compare/v2.0.140-alpha.0...v2.0.141-alpha.0) (2023-05-16)
7
13
 
8
14
  ### Features
@@ -149,11 +149,12 @@
149
149
  "title": "Navbar",
150
150
  "type": "object",
151
151
  "description": "Navbar configuration",
152
- "required": ["image"],
152
+ "required": ["logo"],
153
153
  "properties": {
154
154
  "logo": {
155
155
  "title": "Logo",
156
156
  "type": "object",
157
+ "required": ["src"],
157
158
  "properties": {
158
159
  "src": {
159
160
  "title": "Image",
@@ -194,6 +195,11 @@
194
195
  "title": "Call to Action",
195
196
  "type": "string",
196
197
  "default": "Sign In"
198
+ },
199
+ "myAccountLabel": {
200
+ "title": "My Account Label",
201
+ "type": "string",
202
+ "default": "My Account"
197
203
  }
198
204
  }
199
205
  },
@@ -272,6 +278,41 @@
272
278
  }
273
279
  }
274
280
  }
281
+ },
282
+ "menu": {
283
+ "type": "object",
284
+ "title": "Menu",
285
+ "properties": {
286
+ "icon": {
287
+ "title": "Icon",
288
+ "type": "object",
289
+ "properties": {
290
+ "icon": {
291
+ "title": "Icon",
292
+ "type": "string",
293
+ "enumNames": ["List"],
294
+ "enum": ["List"],
295
+ "default": "List"
296
+ },
297
+ "alt": {
298
+ "title": "Alternative Label",
299
+ "type": "string",
300
+ "default": "List"
301
+ }
302
+ }
303
+ }
304
+ }
305
+ },
306
+ "home": {
307
+ "title": "Home",
308
+ "type": "object",
309
+ "properties": {
310
+ "label": {
311
+ "title": "Go to Home Label",
312
+ "type": "string",
313
+ "default": "Go to Home"
314
+ }
315
+ }
275
316
  }
276
317
  }
277
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.141-alpha.0",
3
+ "version": "2.0.142-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,10 +30,10 @@
30
30
  "@envelop/parser-cache": "^2.2.0",
31
31
  "@envelop/validation-cache": "^2.2.0",
32
32
  "@faststore/api": "^2.0.140-alpha.0",
33
- "@faststore/components": "^2.0.141-alpha.0",
33
+ "@faststore/components": "^2.0.142-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.118-alpha.0",
36
- "@faststore/ui": "^2.0.139-alpha.0",
36
+ "@faststore/ui": "^2.0.142-alpha.0",
37
37
  "@types/react": "^18.0.14",
38
38
  "@vtex/client-cms": "^0.2.12",
39
39
  "autoprefixer": "^10.4.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "5c57dd9fc1c129a9e59e273b3c5c7d9b19d2a4fb"
111
+ "gitHead": "d03c47af5c1e66cec599d8dec1fd211c5ec01afc"
112
112
  }
@@ -1,20 +1,20 @@
1
1
  import {
2
+ Icon as UIIcon,
2
3
  Badge as UIBadge,
3
- Icon,
4
4
  IconButton as UIIconButton,
5
5
  } from '@faststore/ui'
6
6
 
7
7
  import { useCartToggleButton } from 'src/sdk/cart/useCartToggleButton'
8
8
 
9
- function CartToggle() {
9
+ function CartToggle({ alt, icon }: { alt: string; icon: string }) {
10
10
  const btnProps = useCartToggleButton()
11
11
  const totalItems = btnProps['data-items']
12
12
 
13
13
  return (
14
14
  <UIIconButton
15
15
  data-fs-cart-toggle
16
- aria-label={`Cart with ${totalItems} items`}
17
- icon={<Icon name="ShoppingCart" width={32} height={32} />}
16
+ aria-label={alt}
17
+ icon={<UIIcon name={icon} width={32} height={32} />}
18
18
  {...btnProps}
19
19
  >
20
20
  <UIBadge counter>{totalItems}</UIBadge>
@@ -7,11 +7,11 @@ import { PageContentType, getPage } from 'src/server/cms'
7
7
 
8
8
  import RegionBar from 'src/components/common/RegionBar'
9
9
  import Toast from 'src/components/common/Toast'
10
- import Navbar from 'src/components/navigation/Navbar'
11
10
  import RenderSections from './RenderSections'
12
11
 
12
+ import Alert from 'src/components/sections/Alert'
13
+ import Navbar from 'src/components/sections/Navbar'
13
14
  import Footer from 'src/components/sections/Footer'
14
- import Alert from 'src/components/sections/Alert/Alert'
15
15
 
16
16
  export const GLOBAL_SECTIONS_CONTENT_TYPE = 'globalSections'
17
17
 
@@ -23,6 +23,7 @@ export type GlobalSectionsData = {
23
23
  const COMPONENTS: Record<string, ComponentType<any>> = {
24
24
  Alert,
25
25
  Footer,
26
+ Navbar,
26
27
  ...CUSTOM_COMPONENTS,
27
28
  }
28
29
 
@@ -49,7 +50,6 @@ function GlobalSections({
49
50
  return (
50
51
  <>
51
52
  <RenderSections sections={firstSections} components={COMPONENTS} />
52
- <Navbar />
53
53
 
54
54
  <Toast />
55
55
 
@@ -1,30 +1,80 @@
1
1
  import { Suspense, useRef, useState } from 'react'
2
2
 
3
3
  import {
4
+ useUI,
5
+ useScrollDirection,
4
6
  Icon as UIIcon,
5
- IconButton as UIIconButton,
6
7
  Navbar as UINavbar,
8
+ NavbarRow as UINavbarRow,
9
+ IconButton as UIIconButton,
7
10
  NavbarButtons as UINavbarButtons,
8
11
  NavbarHeader as UINavbarHeader,
9
- NavbarRow as UINavbarRow,
10
- useScrollDirection,
11
- useUI,
12
12
  } from '@faststore/ui'
13
13
 
14
+ import { mark } from 'src/sdk/tests/mark'
15
+
14
16
  import CartToggle from 'src/components/cart/CartToggle'
15
- import type { SearchInputRef } from 'src/components/search/SearchInput'
16
17
  import SearchInput from 'src/components/search/SearchInput'
17
- import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
18
+ import type { SearchInputRef } from 'src/components/search/SearchInput'
19
+
18
20
  import Link from 'src/components/ui/Link'
19
21
  import Logo from 'src/components/ui/Logo'
20
- import { mark } from 'src/sdk/tests/mark'
22
+ import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
21
23
 
22
24
  import NavbarLinks from '../NavbarLinks'
23
25
  import NavbarSlider from '../NavbarSlider'
26
+ import type { NavbarProps as SectionNavbarProps } from '../../sections/Navbar'
24
27
 
25
- import styles from './section.module.scss'
28
+ export interface NavbarProps {
29
+ /**
30
+ * Logo props.
31
+ */
32
+ logo: SectionNavbarProps['logo']
33
+ /**
34
+ * Cart props.
35
+ */
36
+ cart: SectionNavbarProps['cartIcon']
37
+ /**
38
+ * Sign In props.
39
+ */
40
+ signIn: {
41
+ button: SectionNavbarProps['signInButton']
42
+ }
43
+ /**
44
+ * Region props.
45
+ */
46
+ region: {
47
+ icon: string
48
+ label: string
49
+ shouldDisplayRegion: boolean
50
+ }
51
+ /**
52
+ * Page links.
53
+ */
54
+ links: SectionNavbarProps['navigation']['pageLinks']
55
+ /**
56
+ * Home props.
57
+ */
58
+ home: SectionNavbarProps['navigation']['home']
59
+ /**
60
+ * Menu props.
61
+ */
62
+ menu: SectionNavbarProps['navigation']['menu']
63
+ }
26
64
 
27
- function Navbar() {
65
+ function Navbar({
66
+ cart,
67
+ logo,
68
+ home,
69
+ links,
70
+ signIn,
71
+ region,
72
+ home: { label: homeLabel },
73
+ signIn: { button: signInButton },
74
+ menu: {
75
+ icon: { icon: menuIcon, alt: menuIconAlt },
76
+ },
77
+ }: NavbarProps) {
28
78
  const scrollDirection = useScrollDirection()
29
79
  const { openNavbar, navbar: displayNavbar } = useUI()
30
80
  const searchMobileRef = useRef<SearchInputRef>(null)
@@ -36,67 +86,73 @@ function Navbar() {
36
86
  }
37
87
 
38
88
  return (
39
- <header className={`section ${styles.section} section-navbar`}>
40
- <UINavbar scrollDirection={scrollDirection}>
41
- <UINavbarHeader>
42
- <UINavbarRow className="layout__content">
43
- {!searchExpanded && (
44
- <>
45
- <UIIconButton
46
- data-fs-navbar-button-menu
47
- aria-label="Open Menu"
48
- icon={<UIIcon name="List" width={32} height={32} />}
49
- onClick={openNavbar}
50
- />
51
- <Link
52
- href="/"
53
- prefetch={false}
54
- aria-label="Go to Faststore home"
55
- title="Go to Faststore home"
56
- data-fs-navbar-logo
57
- >
58
- <Logo />
59
- </Link>
60
- </>
61
- )}
89
+ <UINavbar scrollDirection={scrollDirection}>
90
+ <UINavbarHeader>
91
+ <UINavbarRow className="layout__content">
92
+ {!searchExpanded && (
93
+ <>
94
+ <UIIconButton
95
+ data-fs-navbar-button-menu
96
+ onClick={openNavbar}
97
+ aria-label={menuIconAlt}
98
+ icon={<UIIcon name={menuIcon} width={32} height={32} />}
99
+ />
100
+ <Link
101
+ href="/"
102
+ data-fs-navbar-logo
103
+ prefetch={false}
104
+ title={homeLabel}
105
+ aria-label={homeLabel}
106
+ >
107
+ <Logo {...logo} />
108
+ </Link>
109
+ </>
110
+ )}
62
111
 
63
- <SearchInput />
64
-
65
- <UINavbarButtons searchExpanded={searchExpanded}>
66
- {searchExpanded && (
67
- <UIIconButton
68
- data-fs-button-collapse
69
- aria-label="Collapse search bar"
70
- icon={<UIIcon name="CaretLeft" width={32} height={32} />}
71
- onClick={() => {
72
- setSearchExpanded(false)
73
- searchMobileRef.current?.resetSearchInput()
74
- }}
75
- />
76
- )}
77
-
78
- <SearchInput
79
- placeholder=""
80
- ref={searchMobileRef}
81
- testId="store-input-mobile"
82
- buttonTestId="store-input-mobile-button"
83
- onSearchClick={handlerExpandSearch}
112
+ <SearchInput />
113
+
114
+ <UINavbarButtons searchExpanded={searchExpanded}>
115
+ {searchExpanded && (
116
+ <UIIconButton
117
+ data-fs-button-collapse
118
+ aria-label="Collapse search bar"
119
+ icon={<UIIcon name="CaretLeft" width={32} height={32} />}
120
+ onClick={() => {
121
+ setSearchExpanded(false)
122
+ searchMobileRef.current?.resetSearchInput()
123
+ }}
84
124
  />
125
+ )}
126
+
127
+ <SearchInput
128
+ placeholder=""
129
+ ref={searchMobileRef}
130
+ testId="store-input-mobile"
131
+ buttonTestId="store-input-mobile-button"
132
+ onSearchClick={handlerExpandSearch}
133
+ />
85
134
 
86
- <Suspense fallback={<ButtonSignInFallback />}>
87
- <ButtonSignIn />
88
- </Suspense>
135
+ <Suspense fallback={<ButtonSignInFallback />}>
136
+ <ButtonSignIn {...signInButton} />
137
+ </Suspense>
89
138
 
90
- <CartToggle />
91
- </UINavbarButtons>
92
- </UINavbarRow>
93
- </UINavbarHeader>
139
+ <CartToggle {...cart} />
140
+ </UINavbarButtons>
141
+ </UINavbarRow>
142
+ </UINavbarHeader>
94
143
 
95
- <NavbarLinks className="hidden-mobile" />
144
+ <NavbarLinks links={links} region={region} className="hidden-mobile" />
96
145
 
97
- {displayNavbar && <NavbarSlider />}
98
- </UINavbar>
99
- </header>
146
+ {displayNavbar && (
147
+ <NavbarSlider
148
+ home={home}
149
+ logo={logo}
150
+ links={links}
151
+ signIn={signIn}
152
+ region={region}
153
+ />
154
+ )}
155
+ </UINavbar>
100
156
  )
101
157
  }
102
158
 
@@ -1 +1,2 @@
1
1
  export { default } from './Navbar'
2
+ export type { NavbarProps } from './Navbar'
@@ -1,57 +1,44 @@
1
1
  import type { AnchorHTMLAttributes } from 'react'
2
2
 
3
- import type { NavbarLinksProps as UINavbarLinksProps } from '@faststore/ui'
4
3
  import {
5
4
  NavbarLinks as UINavbarLinks,
6
5
  NavbarLinksList as UINavbarLinksList,
7
6
  NavbarLinksListItem as UINavbarLinksListItem,
8
7
  } from '@faststore/ui'
8
+ import type { NavbarLinksProps as UINavbarLinksProps } from '@faststore/ui'
9
9
 
10
- import RegionButton from 'src/components/region/RegionButton'
11
10
  import Link from 'src/components/ui/Link'
11
+ import RegionButton from 'src/components/region/RegionButton'
12
+ import type { NavbarProps } from 'src/components/navigation/Navbar'
13
+
12
14
  import { mark } from 'src/sdk/tests/mark'
13
15
 
14
- export interface NavbarLinksProps extends UINavbarLinksProps {
16
+ interface NavbarLinksProps extends UINavbarLinksProps {
17
+ links: NavbarProps['links']
18
+ region: NavbarProps['region']
15
19
  /**
16
20
  * Callback function when a link is clicked.
17
21
  */
18
22
  onClickLink?: AnchorHTMLAttributes<HTMLAnchorElement>['onClick']
19
23
  }
20
24
 
21
- const collections = [
22
- {
23
- name: 'Office',
24
- href: '/office',
25
- },
26
- {
27
- name: 'Home Appliances',
28
- href: '/kitchen---home-appliances',
29
- },
30
- {
31
- name: 'Computer and Software',
32
- href: '/computer---software',
33
- },
34
- {
35
- name: 'Technology',
36
- href: '/technology',
37
- },
38
- ]
39
-
40
- function NavbarLinks({ onClickLink, ...otherProps }: NavbarLinksProps) {
25
+ function NavbarLinks({
26
+ links,
27
+ onClickLink,
28
+ region: { icon: regionIcon, label: regionLabel, shouldDisplayRegion },
29
+ ...otherProps
30
+ }: NavbarLinksProps) {
41
31
  return (
42
32
  <UINavbarLinks {...otherProps}>
43
33
  <div className="layout__content">
44
- <RegionButton />
34
+ {shouldDisplayRegion && (
35
+ <RegionButton icon={regionIcon} label={regionLabel} />
36
+ )}
45
37
  <UINavbarLinksList>
46
- {collections.map(({ href, name }) => (
47
- <UINavbarLinksListItem key={name}>
48
- <Link
49
- variant="display"
50
- href={href}
51
- prefetch={false}
52
- onClick={onClickLink}
53
- >
54
- {name}
38
+ {links.map(({ url, text }) => (
39
+ <UINavbarLinksListItem key={text}>
40
+ <Link variant="display" href={url} onClick={onClickLink}>
41
+ {text}
55
42
  </Link>
56
43
  </UINavbarLinksListItem>
57
44
  ))}
@@ -12,11 +12,27 @@ import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
12
12
  import Link from 'src/components/ui/Link'
13
13
  import Logo from 'src/components/ui/Logo'
14
14
  import { mark } from 'src/sdk/tests/mark'
15
+
15
16
  import NavbarLinks from '../NavbarLinks'
17
+ import type { NavbarProps } from '../Navbar'
18
+
19
+ import styles from '../../sections/Navbar/section.module.scss'
16
20
 
17
- import styles from '../Navbar/section.module.scss'
21
+ interface NavbarSliderProps {
22
+ logo: NavbarProps['logo']
23
+ home: NavbarProps['home']
24
+ links: NavbarProps['links']
25
+ region: NavbarProps['region']
26
+ signIn: NavbarProps['signIn']
27
+ }
18
28
 
19
- function NavbarSlider() {
29
+ function NavbarSlider({
30
+ logo,
31
+ links,
32
+ region,
33
+ home: { label: homeLabel },
34
+ signIn: { button: signInButton },
35
+ }: NavbarSliderProps) {
20
36
  const { closeNavbar } = useUI()
21
37
  const { fade, fadeOut } = useFadeEffect()
22
38
 
@@ -33,19 +49,19 @@ function NavbarSlider() {
33
49
  <Link
34
50
  href="/"
35
51
  onClick={fadeOut}
36
- aria-label="Go to FastStore home"
37
- title="Go to FastStore home"
52
+ title={homeLabel}
53
+ aria-label={homeLabel}
38
54
  data-fs-navbar-slider-logo
39
55
  >
40
- <Logo />
56
+ <Logo {...logo} />
41
57
  </Link>
42
58
  </UINavbarSliderHeader>
43
59
  <UINavbarSliderContent>
44
- <NavbarLinks onClickLink={fadeOut} />
60
+ <NavbarLinks onClickLink={fadeOut} links={links} region={region} />
45
61
  </UINavbarSliderContent>
46
62
  <UINavbarSliderFooter>
47
63
  <Suspense fallback={<ButtonSignInFallback />}>
48
- <ButtonSignIn />
64
+ <ButtonSignIn {...signInButton} />
49
65
  </Suspense>
50
66
  </UINavbarSliderFooter>
51
67
  </UINavbarSlider>
@@ -3,7 +3,7 @@ import { Button as UIButton } from '@faststore/ui'
3
3
  import { Icon, useUI } from '@faststore/ui'
4
4
  import { useSession } from 'src/sdk/session'
5
5
 
6
- function RegionButton() {
6
+ function RegionButton({ icon, label }: { icon: string; label: string }) {
7
7
  const { openModal } = useUI()
8
8
  const { postalCode } = useSession()
9
9
 
@@ -11,11 +11,11 @@ function RegionButton() {
11
11
  <UIButton
12
12
  variant="tertiary"
13
13
  size="small"
14
- icon={<Icon name="MapPin" width={18} height={18} weight="bold" />}
14
+ icon={<Icon name={icon} width={18} height={18} weight="bold" />}
15
15
  iconPosition="left"
16
16
  onClick={openModal}
17
17
  >
18
- {postalCode ?? 'Set your location'}
18
+ {postalCode ?? label}
19
19
  </UIButton>
20
20
  )
21
21
  }
@@ -0,0 +1 @@
1
+ export { default } from './Alert'
@@ -11,7 +11,7 @@ import UIFooter, {
11
11
  } from '../../common/Footer'
12
12
  import type { FooterLinksProps, FooterSocialProps } from '../../common/Footer'
13
13
 
14
- import { Image } from '../../ui/Image'
14
+ import Logo from 'src/components/ui/Logo'
15
15
  import UIIncentives from '../../ui/Incentives'
16
16
  import type { Incentive } from '../../ui/Incentives'
17
17
 
@@ -61,14 +61,7 @@ const Footer = ({
61
61
  />
62
62
  </UIFooterNavigation>
63
63
  <UIFooterInfo>
64
- <Image
65
- data-fs-footer-logo
66
- loading="lazy"
67
- src={logoSrc}
68
- alt={logoAlt}
69
- width={112}
70
- height={119}
71
- />
64
+ <Logo alt={logoAlt} src={logoSrc} />
72
65
  {showPaymentMethods && (
73
66
  <UIPaymentMethods
74
67
  flagList={paymentMethods}