@faststore/core 2.0.113-alpha.0 → 2.0.114-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 (157) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/CHANGELOG.md +4 -0
  3. package/package.json +4 -4
  4. package/src/Layout.tsx +1 -1
  5. package/src/components/common/Navbar/NavLinks.stories.mdx +122 -0
  6. package/src/components/{navigation/NavbarLinks/NavbarLinks.tsx → common/Navbar/NavLinks.tsx} +12 -18
  7. package/src/components/common/Navbar/Navbar.stories.mdx +179 -0
  8. package/src/components/{navigation → common}/Navbar/Navbar.tsx +26 -35
  9. package/src/components/common/Navbar/NavbarSlider.stories.mdx +108 -0
  10. package/src/components/{navigation/NavbarSlider → common/Navbar}/NavbarSlider.tsx +21 -18
  11. package/src/components/common/Navbar/index.ts +3 -0
  12. package/src/components/common/Navbar/navbar-slider.module.scss +53 -0
  13. package/src/components/common/Navbar/navbar.module.scss +204 -0
  14. package/src/components/common/Navbar/navlinks.module.scss +96 -0
  15. package/src/sdk/ui/useScrollDirection.ts +31 -0
  16. package/.next/BUILD_ID +0 -1
  17. package/.next/build-manifest.json +0 -99
  18. package/.next/cache/.tsbuildinfo +0 -1
  19. package/.next/cache/config.json +0 -7
  20. package/.next/cache/eslint/.cache_1gneedd +0 -1
  21. package/.next/cache/next-server.js.nft.json +0 -1
  22. package/.next/cache/webpack/client-production/0.pack +0 -0
  23. package/.next/cache/webpack/client-production/index.pack +0 -0
  24. package/.next/cache/webpack/server-production/0.pack +0 -0
  25. package/.next/cache/webpack/server-production/index.pack +0 -0
  26. package/.next/export-marker.json +0 -1
  27. package/.next/images-manifest.json +0 -1
  28. package/.next/next-server.js.nft.json +0 -1
  29. package/.next/package.json +0 -1
  30. package/.next/prerender-manifest.json +0 -1
  31. package/.next/react-loadable-manifest.json +0 -42
  32. package/.next/required-server-files.json +0 -1
  33. package/.next/routes-manifest.json +0 -1
  34. package/.next/server/chunks/120.js +0 -435
  35. package/.next/server/chunks/123.js +0 -58
  36. package/.next/server/chunks/1394.js +0 -3801
  37. package/.next/server/chunks/1597.js +0 -151
  38. package/.next/server/chunks/1608.js +0 -515
  39. package/.next/server/chunks/2154.js +0 -206
  40. package/.next/server/chunks/247.js +0 -61
  41. package/.next/server/chunks/2502.js +0 -584
  42. package/.next/server/chunks/2914.js +0 -95
  43. package/.next/server/chunks/2922.js +0 -7293
  44. package/.next/server/chunks/3264.js +0 -67
  45. package/.next/server/chunks/3431.js +0 -7241
  46. package/.next/server/chunks/350.js +0 -142
  47. package/.next/server/chunks/3746.js +0 -250
  48. package/.next/server/chunks/3898.js +0 -240
  49. package/.next/server/chunks/4312.js +0 -674
  50. package/.next/server/chunks/4371.js +0 -1424
  51. package/.next/server/chunks/5098.js +0 -124
  52. package/.next/server/chunks/5335.js +0 -544
  53. package/.next/server/chunks/5576.js +0 -72
  54. package/.next/server/chunks/6280.js +0 -322
  55. package/.next/server/chunks/6465.js +0 -91
  56. package/.next/server/chunks/676.js +0 -32
  57. package/.next/server/chunks/6859.js +0 -959
  58. package/.next/server/chunks/6881.js +0 -320
  59. package/.next/server/chunks/6898.js +0 -149
  60. package/.next/server/chunks/7104.js +0 -235
  61. package/.next/server/chunks/7181.js +0 -664
  62. package/.next/server/chunks/7183.js +0 -72
  63. package/.next/server/chunks/8098.js +0 -246
  64. package/.next/server/chunks/810.js +0 -432
  65. package/.next/server/chunks/8287.js +0 -58
  66. package/.next/server/chunks/9143.js +0 -106
  67. package/.next/server/chunks/9557.js +0 -119
  68. package/.next/server/chunks/9854.js +0 -72
  69. package/.next/server/chunks/font-manifest.json +0 -1
  70. package/.next/server/font-manifest.json +0 -1
  71. package/.next/server/middleware-build-manifest.js +0 -1
  72. package/.next/server/middleware-manifest.json +0 -6
  73. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  74. package/.next/server/pages/404.js.nft.json +0 -1
  75. package/.next/server/pages/500.js.nft.json +0 -1
  76. package/.next/server/pages/[...slug].js +0 -666
  77. package/.next/server/pages/[...slug].js.nft.json +0 -1
  78. package/.next/server/pages/[slug]/p.js +0 -2327
  79. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  80. package/.next/server/pages/_app.js +0 -2442
  81. package/.next/server/pages/_app.js.nft.json +0 -1
  82. package/.next/server/pages/_document.js +0 -304
  83. package/.next/server/pages/_document.js.nft.json +0 -1
  84. package/.next/server/pages/_error.js +0 -164
  85. package/.next/server/pages/_error.js.nft.json +0 -1
  86. package/.next/server/pages/account.js.nft.json +0 -1
  87. package/.next/server/pages/api/graphql.js +0 -315
  88. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  89. package/.next/server/pages/api/preview.js +0 -118
  90. package/.next/server/pages/api/preview.js.nft.json +0 -1
  91. package/.next/server/pages/checkout.js.nft.json +0 -1
  92. package/.next/server/pages/en-US/404.html +0 -81
  93. package/.next/server/pages/en-US/500.html +0 -81
  94. package/.next/server/pages/en-US/account.html +0 -81
  95. package/.next/server/pages/en-US/checkout.html +0 -81
  96. package/.next/server/pages/en-US/login.html +0 -81
  97. package/.next/server/pages/en-US/s.html +0 -81
  98. package/.next/server/pages/en-US.html +0 -81
  99. package/.next/server/pages/en-US.json +0 -1
  100. package/.next/server/pages/index.js +0 -474
  101. package/.next/server/pages/index.js.nft.json +0 -1
  102. package/.next/server/pages/login.js.nft.json +0 -1
  103. package/.next/server/pages/s.js.nft.json +0 -1
  104. package/.next/server/pages-manifest.json +0 -16
  105. package/.next/server/webpack-api-runtime.js +0 -229
  106. package/.next/server/webpack-runtime.js +0 -229
  107. package/.next/static/FoOP4frMbgwDj5doLKiqK/_buildManifest.js +0 -1
  108. package/.next/static/FoOP4frMbgwDj5doLKiqK/_ssgManifest.js +0 -1
  109. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  110. package/.next/static/chunks/170.79b2f8527e327bca.js +0 -1
  111. package/.next/static/chunks/264-5b07911df63b8601.js +0 -1
  112. package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
  113. package/.next/static/chunks/54.e6562383f8a1dfe7.js +0 -1
  114. package/.next/static/chunks/597.fc79494903e8bb84.js +0 -1
  115. package/.next/static/chunks/608.59e69b83f35d9c44.js +0 -1
  116. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  117. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  118. package/.next/static/chunks/781-e1b538e051ff4c3e.js +0 -1
  119. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  120. package/.next/static/chunks/996.98e590872c51f815.js +0 -1
  121. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  122. package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
  123. package/.next/static/chunks/pages/404-3637ef83b3359df7.js +0 -1
  124. package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
  125. package/.next/static/chunks/pages/[...slug]-29d3b81ee0953846.js +0 -1
  126. package/.next/static/chunks/pages/[slug]/p-74cef56b58dadbab.js +0 -1
  127. package/.next/static/chunks/pages/_app-501ccc46c846c040.js +0 -1
  128. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  129. package/.next/static/chunks/pages/account-b8fc5222ffe89b60.js +0 -1
  130. package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
  131. package/.next/static/chunks/pages/index-3aae9f104d28d1a1.js +0 -1
  132. package/.next/static/chunks/pages/login-45cc84352bac2408.js +0 -1
  133. package/.next/static/chunks/pages/s-ba2868e14fedb65b.js +0 -1
  134. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  135. package/.next/static/chunks/webpack-855ba0986bd6023a.js +0 -1
  136. package/.next/static/css/1f987650dd4e39d0.css +0 -1
  137. package/.next/static/css/231b8c31105a684a.css +0 -1
  138. package/.next/static/css/3a57acf6e411f24d.css +0 -1
  139. package/.next/static/css/4abccf9803c3c356.css +0 -1
  140. package/.next/static/css/6507cb48401e73a4.css +0 -1
  141. package/.next/static/css/6f4d3e91f1d161a8.css +0 -1
  142. package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
  143. package/.next/trace +0 -64
  144. package/public/~partytown/debug/partytown-atomics.js +0 -556
  145. package/public/~partytown/debug/partytown-media.js +0 -374
  146. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  147. package/public/~partytown/debug/partytown-sw.js +0 -59
  148. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  149. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  150. package/public/~partytown/debug/partytown.js +0 -72
  151. package/public/~partytown/partytown-atomics.js +0 -2
  152. package/public/~partytown/partytown-media.js +0 -2
  153. package/public/~partytown/partytown-sw.js +0 -2
  154. package/public/~partytown/partytown.js +0 -2
  155. package/src/components/navigation/Navbar/index.ts +0 -1
  156. package/src/components/navigation/NavbarLinks/index.ts +0 -1
  157. package/src/components/navigation/NavbarSlider/index.ts +0 -1
@@ -26,26 +26,26 @@ info - Finalizing page optimization...
26
26
  Route (pages) Size First Load JS
27
27
  ┌ ● / 8.65 kB 117 kB
28
28
  ├ └ css/3a57acf6e411f24d.css 1.69 kB
29
- ├ /_app 0 B 96.7 kB
29
+ ├ /_app 0 B 96.6 kB
30
30
  ├ ● /[...slug] 9.46 kB 122 kB
31
31
  ├ └ css/1f987650dd4e39d0.css 1.33 kB
32
32
  ├ ● /[slug]/p 16.8 kB 125 kB
33
33
  ├ └ css/4abccf9803c3c356.css 1.82 kB
34
- ├ ○ /404 665 B 103 kB
34
+ ├ ○ /404 665 B 102 kB
35
35
  ├ ○ /500 439 B 102 kB
36
36
  ├ ○ /account 383 B 102 kB
37
- ├ λ /api/graphql 0 B 96.7 kB
38
- ├ λ /api/preview 0 B 96.7 kB
37
+ ├ λ /api/graphql 0 B 96.6 kB
38
+ ├ λ /api/preview 0 B 96.6 kB
39
39
  ├ ○ /checkout 371 B 102 kB
40
- ├ ○ /login 577 B 103 kB
40
+ ├ ○ /login 577 B 102 kB
41
41
  └ ○ /s 895 B 113 kB
42
42
  └ css/6f4d3e91f1d161a8.css 1.29 kB
43
43
  + First Load JS shared by all 120 kB
44
44
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
45
45
  ├ chunks/main-9746772201fe3ac1.js 23.9 kB
46
- ├ chunks/pages/_app-501ccc46c846c040.js 25.4 kB
47
- ├ chunks/webpack-855ba0986bd6023a.js 2.15 kB
48
- └ css/231b8c31105a684a.css 23.6 kB
46
+ ├ chunks/pages/_app-9d067ed89f7a4001.js 25.3 kB
47
+ ├ chunks/webpack-62b0142505600323.js 2.15 kB
48
+ └ css/b32231bee7a654b8.css 23.6 kB
49
49
 
50
50
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
51
51
  ○ (Static) automatically rendered as static HTML (uses no initial props)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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.114-alpha.0](https://github.com/vtex/faststore/compare/v2.0.113-alpha.0...v2.0.114-alpha.0) (2023-04-24)
7
+
8
+ **Note:** Version bump only for package @faststore/core
9
+
6
10
  ## [2.0.113-alpha.0](https://github.com/vtex/faststore/compare/v2.0.112-alpha.0...v2.0.113-alpha.0) (2023-04-24)
7
11
 
8
12
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.113-alpha.0",
3
+ "version": "2.0.114-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.105-alpha.0",
33
- "@faststore/components": "^2.0.113-alpha.0",
33
+ "@faststore/components": "^2.0.114-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.3-alpha.0",
36
- "@faststore/ui": "^2.0.113-alpha.0",
36
+ "@faststore/ui": "^2.0.114-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": "d98da992d055d403b4beb5b15f74829a017bb763"
111
+ "gitHead": "3d49923a96682db78955fcf81e6f134161de0d40"
112
112
  }
package/src/Layout.tsx CHANGED
@@ -4,7 +4,7 @@ import { lazy, Suspense } from 'react'
4
4
  import { Icon, useUI } from '@faststore/ui'
5
5
  import Alert from 'src/components/common/Alert'
6
6
  import Footer from 'src/components/common/Footer'
7
- import Navbar from 'src/components/navigation/Navbar'
7
+ import Navbar from 'src/components/common/Navbar'
8
8
  import Toast from 'src/components/common/Toast'
9
9
  import RegionBar from 'src/components/region/RegionBar'
10
10
 
@@ -0,0 +1,122 @@
1
+ import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import { UIProvider } from '@faststore/ui'
4
+
5
+ import { NavLinks } from '.'
6
+
7
+ import {
8
+ TokenTable,
9
+ TokenRow,
10
+ TokenDivider,
11
+ } from 'src/../.storybook/components'
12
+
13
+ <Meta component={NavLinks} title="Organisms/Navbar/NavLinks" />
14
+
15
+ export const TemplateProvider = () => {
16
+ return (
17
+ <UIProvider>
18
+ <NavLinks />
19
+ </UIProvider>
20
+ )
21
+ }
22
+
23
+ <header>
24
+
25
+ # NavLinks
26
+
27
+ Displays a set navigation links and self adapts on mobile [NavbarSlider](?path=/docs/organisms-navbar-navbarslider--overview-default) or desktop screens.
28
+
29
+ </header>
30
+
31
+ ## Usage
32
+
33
+ `import { NavLinks } from 'src/components/common/Navbar'`
34
+
35
+ <Canvas>
36
+ <Story name="overview-default">{TemplateProvider.bind({})}</Story>
37
+ </Canvas>
38
+
39
+ <TokenTable>
40
+ <TokenRow
41
+ token="--fs-navlinks-padding-top-notebook"
42
+ value="var(--fs-spacing-1)"
43
+ />
44
+ <TokenRow
45
+ token="--fs-navlinks-padding-bottom-notebook"
46
+ value="var(--fs-navlinks-padding-top-notebook)"
47
+ />
48
+ <TokenDivider />
49
+ <TokenRow
50
+ token="--fs-navlinks-bkg-color"
51
+ value="--fs-color-body-bkg"
52
+ isColor
53
+ />
54
+ <TokenDivider />
55
+ <TokenRow
56
+ token="--fs-navlinks-transition-property"
57
+ value="var(--fs-transition-property)"
58
+ />
59
+ <TokenRow
60
+ token="--fs-navlinks-transition-timing"
61
+ value="var(--fs-transition-timing)"
62
+ />
63
+ <TokenRow
64
+ token="--fs-navlinks-transition-function"
65
+ value="var(--fs-transition-function)"
66
+ />
67
+ <TokenDivider />
68
+ <TokenRow
69
+ token="--fs-navlinks-border-top-width-mobile"
70
+ value="var(--fs-border-width)"
71
+ />
72
+ <TokenRow
73
+ token="--fs-navlinks-border-top-color-mobile"
74
+ value="var(--fs-border-color-light)"
75
+ isColor
76
+ />
77
+ <TokenRow
78
+ token="--fs-navlinks-border-bottom-width-mobile"
79
+ value="var(--fs-navlinks-border-top-width-mobile)"
80
+ />
81
+ <TokenRow
82
+ token="--fs-navlinks-border-bottom-color-mobile"
83
+ value="var(--fs-navlinks-border-top-color-mobile)"
84
+ globalValue="var(--fs-border-color-light)"
85
+ isColor
86
+ />
87
+ </TokenTable>
88
+
89
+ ---
90
+
91
+ ## Nested Elements
92
+
93
+ ### Link
94
+
95
+ <TokenTable>
96
+ <TokenRow token="--fs-navlinks-link-width-notebook" value="auto" />
97
+ <TokenRow
98
+ token="--fs-navlinks-link-padding-notebook"
99
+ value="0 var(--fs-spacing-0)"
100
+ />
101
+ </TokenTable>
102
+
103
+ ### List
104
+
105
+ <TokenTable>
106
+ <TokenRow
107
+ token="--fs-navlinks-list-padding-left-notebook"
108
+ value="var(--fs-spacing-3)"
109
+ />
110
+ <TokenRow
111
+ token="--fs-navlinks-list-margin-left-notebook"
112
+ value="var(--fs-spacing-2)"
113
+ />
114
+ <TokenRow
115
+ token="--fs-navlinks-list-border-left-width-notebook"
116
+ value="var(--fs-border-width)"
117
+ />
118
+ <TokenRow
119
+ token="--fs-navlinks-list-border-left-color-notebook"
120
+ value="var(--fs-border-color-light)"
121
+ />
122
+ </TokenTable>
@@ -1,21 +1,15 @@
1
+ import { List as UIList } from '@faststore/ui'
1
2
  import type { AnchorHTMLAttributes } from 'react'
2
3
 
3
- import type { NavbarLinksProps as UINavbarLinksProps } from '@faststore/ui'
4
- import { List as UIList, NavbarLinks as UINavbarLinks } from '@faststore/ui'
5
-
6
4
  import RegionButton from 'src/components/region/RegionButton'
7
5
  import Link from 'src/components/ui/Link'
8
6
  import { mark } from 'src/sdk/tests/mark'
9
7
 
10
- export interface NavbarLinksProps extends UINavbarLinksProps {
11
- /**
12
- * Defines the classes to be applied.
13
- */
14
- className?: string
15
- /**
16
- * Defines action to be performed when clicking on a link.
17
- */
8
+ import styles from './navlinks.module.scss'
9
+
10
+ interface NavLinksProps {
18
11
  onClickLink?: AnchorHTMLAttributes<HTMLAnchorElement>['onClick']
12
+ classes?: string
19
13
  }
20
14
 
21
15
  const collections = [
@@ -37,16 +31,16 @@ const collections = [
37
31
  },
38
32
  ]
39
33
 
40
- function NavbarLinks({ onClickLink, ...otherProps }: NavbarLinksProps) {
34
+ function NavLinks({ onClickLink, classes = '' }: NavLinksProps) {
41
35
  return (
42
- <UINavbarLinks {...otherProps}>
36
+ <nav className={`${styles.fsNavlinks} ${classes}`}>
43
37
  <div className="layout__content">
44
38
  <RegionButton />
45
- <UIList data-fs-navbar-links-list>
39
+ <UIList data-fs-navlinks-list>
46
40
  {collections.map(({ href, name }) => (
47
- <li key={name} data-fs-navbar-links-list-item>
41
+ <li key={name} data-fs-navlinks-list-item>
48
42
  <Link
49
- data-fs-navbar-links-link
43
+ data-fs-navlinks-link
50
44
  variant="display"
51
45
  href={href}
52
46
  onClick={onClickLink}
@@ -57,8 +51,8 @@ function NavbarLinks({ onClickLink, ...otherProps }: NavbarLinksProps) {
57
51
  ))}
58
52
  </UIList>
59
53
  </div>
60
- </UINavbarLinks>
54
+ </nav>
61
55
  )
62
56
  }
63
57
 
64
- export default mark(NavbarLinks)
58
+ export default mark(NavLinks)
@@ -0,0 +1,179 @@
1
+ import { UIProvider } from '@faststore/ui'
2
+
3
+ import Navbar, { NavLinks } from '.'
4
+
5
+ import {
6
+ TokenTable,
7
+ TokenRow,
8
+ TokenDivider,
9
+ } from 'src/../.storybook/components'
10
+
11
+ import { SectionList, SectionItem } from 'src/../.storybook/components'
12
+
13
+ import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
14
+
15
+ <Meta component={Navbar} title="Organisms/Navbar/Overview" />
16
+
17
+ export const Template = () => {
18
+ return (
19
+ <UIProvider>
20
+ <Navbar />
21
+ </UIProvider>
22
+ )
23
+ }
24
+
25
+ <header>
26
+
27
+ # Navbar
28
+
29
+ The `Navbar` represents the **Page Header** and groups some features like: `Search`, `Regionalization`, `SignIn`, `CartSidebar`.
30
+
31
+ </header>
32
+
33
+ ## Overview
34
+
35
+ Uses [NavLinks](?path=/docs/organisms-navbar-navlinks--overview-default) and [NavbarSlider](?path=/docs/organisms-navbar-navbarslider--overview-default) as compound components.
36
+
37
+ ---
38
+
39
+ ## Usage
40
+
41
+ `import Navbar from 'src/components/common/Navbar'`
42
+
43
+ <Canvas>
44
+ <Story name="overview-default">{Template.bind({})}</Story>
45
+ </Canvas>
46
+
47
+ <TokenTable>
48
+ <TokenRow token="--fs-navbar-height-mobile" value="3.5rem" />
49
+ <TokenDivider />
50
+ <TokenRow
51
+ token="--fs-navbar-bkg-color"
52
+ value="rgb(255 255 255 / 90%)"
53
+ isColor
54
+ />
55
+ <TokenDivider />
56
+ <TokenRow
57
+ token="--fs-navbar-transition-timing"
58
+ value="var(--fs-transition-timing)"
59
+ />
60
+ <TokenRow
61
+ token="--fs-navbar-transition-function"
62
+ value="var(--fs-transition-function)"
63
+ />
64
+ <TokenDivider />
65
+ <TokenRow
66
+ token="--fs-navbar-box-shadow"
67
+ value="0 var(--fs-spacing-0) var(--fs-spacing-3) rgb(0 0 0 / 5%)"
68
+ />
69
+ <TokenDivider />
70
+ <TokenRow
71
+ token="--fs-navbar-border-bottom-width"
72
+ value="var(--fs-border-width)"
73
+ />
74
+ <TokenRow
75
+ token="--fs-navbar-border-bottom-color"
76
+ value="var(--fs-border-color-light)"
77
+ isColor
78
+ />
79
+ </TokenTable>
80
+
81
+ ---
82
+
83
+ ## Nested Elements
84
+
85
+ ### Search
86
+
87
+ <TokenTable>
88
+ <TokenRow
89
+ token="--fs-navbar-search-button-icon-width-mobile"
90
+ value="var(--fs-spacing-5)"
91
+ />
92
+ <TokenRow
93
+ token="--fs-navbar-search-button-icon-height-mobile"
94
+ value="var(--fs-navbar-search-button-icon-width-mobile)"
95
+ />
96
+ </TokenTable>
97
+
98
+ ### Search Expanded
99
+
100
+ <TokenTable>
101
+ <TokenRow
102
+ token="--fs-navbar-search-expanded-input-wrapper-margin-right"
103
+ value="0.625rem"
104
+ />
105
+ <TokenRow
106
+ token="--fs-navbar-search-expanded-input-wrapper-margin-left"
107
+ value="var(--fs-spacing-9)"
108
+ />
109
+ <TokenDivider />
110
+ <TokenRow
111
+ token="--fs-navbar-search-expanded-input-width"
112
+ value="calc(100% - var(--fs-spacing-7))"
113
+ />
114
+ <TokenDivider />
115
+ <TokenRow
116
+ token="--fs-navbar-search-expanded-button-icon-margin-right"
117
+ value="-4.063rem"
118
+ />
119
+ </TokenTable>
120
+
121
+ ### Header
122
+
123
+ <TokenTable>
124
+ <TokenRow token="--fs-navbar-header-padding" value="0 var(--fs-spacing-0)" />
125
+ <TokenDivider />
126
+ <TokenRow
127
+ token="--fs-navbar-header-padding-top-notebook"
128
+ value="var(--fs-spacing-1)"
129
+ />
130
+ <TokenRow
131
+ token="--fs-navbar-header-padding-bottom-notebook"
132
+ value="var(--fs-navbar-header-padding-top-notebook)"
133
+ />
134
+ </TokenTable>
135
+
136
+ ### Logo
137
+
138
+ <TokenTable>
139
+ <TokenRow
140
+ token="--fs-navbar-logo-border-left-width"
141
+ value="var(--fs-border-width)"
142
+ />
143
+ <TokenRow
144
+ token="--fs-navbar-logo-border-left-color"
145
+ value="var(--fs-border-color-light)"
146
+ isColor
147
+ />
148
+ </TokenTable>
149
+
150
+ ---
151
+
152
+ ## Compound Components
153
+
154
+ <SectionList grid="grid">
155
+ <SectionItem
156
+ title="Navbar Slider"
157
+ actionPath="../?path=/docs/organisms-navbar-navbarslider--overview-default"
158
+ description={
159
+ <>
160
+ Displays the <code>NavLinks</code> and some features using{' '}
161
+ <code>SlideOver</code> component.
162
+ </>
163
+ }
164
+ >
165
+ <img src="https://vtexhelp.vtexassets.com/assets/docs/src/navlinks___52dff993e0e04dea5d02c1e1a5bbf4e3.png" />
166
+ </SectionItem>
167
+ <SectionItem
168
+ title="NavLinks"
169
+ actionPath="../?path=/docs/organisms-navbar-navlinks--overview-default"
170
+ description={
171
+ <>
172
+ Displays a set navigation links and self adapts on mobile{' '}
173
+ <code>NavbarSlider</code> or desktop screens.
174
+ </>
175
+ }
176
+ >
177
+ <img src="https://vtexhelp.vtexassets.com/assets/docs/src/navlinks___ad2d67dbdbac8ea8ccb4e5a7d453a997.png" />
178
+ </SectionItem>
179
+ </SectionList>
@@ -1,26 +1,18 @@
1
1
  import { Suspense, useRef, useState } from 'react'
2
2
 
3
- import {
4
- useUI,
5
- useScrollDirection,
6
- Icon as UIIcon,
7
- IconButton as UIIconButton,
8
- Navbar as UINavbar,
9
- NavbarHeader as UINavbarHeader,
10
- NavbarRow as UINavbarRow,
11
- NavbarButtons as UINavbarButtons,
12
- } from '@faststore/ui'
13
-
3
+ import { Icon, IconButton as UIIconButton, useUI } from '@faststore/ui'
14
4
  import CartToggle from 'src/components/cart/CartToggle'
15
- import SearchInput from 'src/components/search/SearchInput'
16
5
  import type { SearchInputRef } from 'src/components/search/SearchInput'
17
- import Logo from 'src/components/ui/Logo'
18
- import Link from 'src/components/ui/Link'
6
+ import SearchInput from 'src/components/search/SearchInput'
19
7
  import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
8
+ import Link from 'src/components/ui/Link'
9
+ import Logo from 'src/components/ui/Logo'
20
10
  import { mark } from 'src/sdk/tests/mark'
11
+ import useScrollDirection from 'src/sdk/ui/useScrollDirection'
21
12
 
22
- import NavbarSlider from '../NavbarSlider'
23
- import NavbarLinks from '../NavbarLinks'
13
+ import styles from './navbar.module.scss'
14
+ import NavbarSlider from './NavbarSlider'
15
+ import NavLinks from './NavLinks'
24
16
 
25
17
  function Navbar() {
26
18
  const scrollDirection = useScrollDirection()
@@ -34,18 +26,19 @@ function Navbar() {
34
26
  }
35
27
 
36
28
  return (
37
- <UINavbar
38
- className="layout__content-full"
39
- scrollDirection={scrollDirection}
29
+ <header
30
+ data-fs-navbar
31
+ data-fs-navbar-scroll={scrollDirection}
32
+ className={`${styles.fsNavbar} layout__content-full`}
40
33
  >
41
- <UINavbarHeader>
42
- <UINavbarRow className="layout__content">
34
+ <section data-fs-navbar-header>
35
+ <div className="layout__content" data-fs-navbar-row>
43
36
  {!searchExpanded && (
44
37
  <>
45
38
  <UIIconButton
46
39
  data-fs-navbar-button-menu
47
40
  aria-label="Open Menu"
48
- icon={<UIIcon name="List" width={32} height={32} />}
41
+ icon={<Icon name="List" width={32} height={32} />}
49
42
  onClick={openNavbar}
50
43
  />
51
44
  <Link
@@ -58,22 +51,22 @@ function Navbar() {
58
51
  </Link>
59
52
  </>
60
53
  )}
61
-
62
54
  <SearchInput />
63
-
64
- <UINavbarButtons searchExpanded={searchExpanded}>
55
+ <div
56
+ data-fs-navbar-buttons
57
+ data-fs-navbar-search-expanded={searchExpanded}
58
+ >
65
59
  {searchExpanded && (
66
60
  <UIIconButton
67
61
  data-fs-button-collapse
68
62
  aria-label="Collapse search bar"
69
- icon={<UIIcon name="CaretLeft" width={32} height={32} />}
63
+ icon={<Icon name="CaretLeft" width={32} height={32} />}
70
64
  onClick={() => {
71
65
  setSearchExpanded(false)
72
66
  searchMobileRef.current?.resetSearchInput()
73
67
  }}
74
68
  />
75
69
  )}
76
-
77
70
  <SearchInput
78
71
  placeholder=""
79
72
  ref={searchMobileRef}
@@ -81,22 +74,20 @@ function Navbar() {
81
74
  buttonTestId="store-input-mobile-button"
82
75
  onSearchClick={handlerExpandSearch}
83
76
  />
84
-
85
77
  <Suspense fallback={<ButtonSignInFallback />}>
86
78
  <ButtonSignIn />
87
79
  </Suspense>
88
-
89
80
  <CartToggle />
90
- </UINavbarButtons>
91
- </UINavbarRow>
92
- </UINavbarHeader>
93
-
94
- <NavbarLinks className="hidden-mobile" />
81
+ </div>
82
+ </div>
83
+ </section>
84
+ <NavLinks classes="hidden-mobile" />
95
85
 
96
86
  {displayNavbar && <NavbarSlider />}
97
- </UINavbar>
87
+ </header>
98
88
  )
99
89
  }
100
90
 
101
91
  Navbar.displayName = 'Navbar'
92
+
102
93
  export default mark(Navbar)
@@ -0,0 +1,108 @@
1
+ import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
+
3
+ import { UIProvider, useUI } from '@faststore/ui'
4
+
5
+ import { Button } from '@faststore/ui'
6
+ import Icon from 'src/components/ui/Icon'
7
+
8
+ import { NavbarSlider } from '.'
9
+
10
+ import {
11
+ TokenTable,
12
+ TokenRow,
13
+ TokenDivider,
14
+ } from 'src/../.storybook/components'
15
+
16
+ <Meta component={NavbarSlider} title="Organisms/Navbar/NavbarSlider" />
17
+
18
+ export const TemplateNavbarSlider = () => {
19
+ const { openNavbar, navbar: displayNavbar } = useUI()
20
+ return (
21
+ <div style={{ display: 'flex', alignItems: 'center' }}>
22
+ <Button
23
+ aria-label="Open Menu"
24
+ icon={<Icon name="List" width={32} height={32} />}
25
+ onClick={openNavbar}
26
+ />
27
+ <p style={{ marginLeft: '12px' }}>Open Menu</p>
28
+ {displayNavbar && <NavbarSlider />}
29
+ </div>
30
+ )
31
+ }
32
+
33
+ export const TemplateProvider = () => {
34
+ return (
35
+ <UIProvider>
36
+ <TemplateNavbarSlider />
37
+ </UIProvider>
38
+ )
39
+ }
40
+
41
+ <header>
42
+
43
+ # Navbar Slider
44
+
45
+ As part of the [Navbar](?path=/docs/organisms-navbar-overview--overview-default), NavbarSlider is its mobile version to list the `NavLinks`.
46
+
47
+ </header>
48
+
49
+ ## Overview
50
+
51
+ Uses [SlideOver](?path=/docs/organisms-slideover--default-story) as base to show [Navlinks](?path=/docs/organisms-navbar-navlinks--overview-default) on mobile devices.
52
+
53
+ ---
54
+
55
+ ## Usage
56
+
57
+ `import { NavbarSlider } from 'src/components/common/Navbar'`
58
+
59
+ <Canvas>
60
+ <Story name="overview-default">{TemplateProvider.bind({})}</Story>
61
+ </Canvas>
62
+
63
+ <TokenTable>
64
+ <TokenRow token="--fs-navbar-slider-padding" value="var(--fs-spacing-3)" />
65
+ </TokenTable>
66
+
67
+ ---
68
+
69
+ ## Nested Elements
70
+
71
+ ### Header
72
+
73
+ <TokenTable>
74
+ <TokenRow
75
+ token="--fs-navbar-slider-header-padding-bottom"
76
+ value="var(--fs-spacing-2)"
77
+ />
78
+ <TokenRow
79
+ token="--fs-navbar-slider-header-button-margin-right"
80
+ value="calc(-1 * var(--fs-spacing-1))"
81
+ />
82
+ </TokenTable>
83
+
84
+ ### Logo
85
+
86
+ <TokenTable>
87
+ <TokenRow token="--fs-navbar-slider-logo-height" value="2.375rem" />
88
+ <TokenDivider />
89
+ <TokenRow token="--fs-navbar-slider-logo-padding" value="0" />
90
+ <TokenDivider />
91
+ <TokenRow
92
+ token="--fs-navbar-slider-logo-margin-right"
93
+ value="var(--fs-spacing-5)"
94
+ />
95
+ </TokenTable>
96
+
97
+ ### Footer
98
+
99
+ <TokenTable>
100
+ <TokenRow
101
+ token="--fs-navbar-slider-footer-padding-top"
102
+ value="var(--fs-spacing-2)"
103
+ />
104
+ <TokenRow
105
+ token="--fs-navbar-slider-footer-margin-top"
106
+ value="var(--fs-spacing-2)"
107
+ />
108
+ </TokenTable>