@nuskin/foundation-ui-components 1.0.0-cft-35.8 → 1.0.0-cft-35.10

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 (85) hide show
  1. package/CHANGELOG.md +60 -3
  2. package/package.json +90 -90
  3. package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +36 -0
  4. package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +21 -0
  5. package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +118 -0
  6. package/src/common/auth-dropdown/NsAuthDropdown.tsx +62 -0
  7. package/src/common/auth-dropdown/index.ts +2 -0
  8. package/src/common/auth-dropdown/types.d.ts +9 -0
  9. package/src/common/banner/NsBanner.spec.tsx +1 -1
  10. package/src/common/banner/NsBanner.stories.tsx +16 -14
  11. package/src/common/banner/index.ts +2 -1
  12. package/src/common/brand-components/NsBrand.stories.tsx +10 -12
  13. package/src/common/brand-components/index.ts +2 -2
  14. package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +21 -0
  15. package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +30 -0
  16. package/src/common/breadcrumb/NsBreadcrumb.styled.tsx +29 -0
  17. package/src/common/breadcrumb/NsBreadcrumb.tsx +61 -0
  18. package/src/common/breadcrumb/index.ts +2 -0
  19. package/src/common/breadcrumb/types.ts +13 -0
  20. package/src/common/button/NsButton.stories.tsx +25 -18
  21. package/src/common/button/index.ts +1 -1
  22. package/src/common/card/NsBrandProductCard.tsx +3 -3
  23. package/src/common/card/stories/NsBgCard.stories.tsx +16 -13
  24. package/src/common/card/stories/NsBrandProductCard.stories.tsx +15 -11
  25. package/src/common/carousal/CarousalControl.tsx +5 -5
  26. package/src/common/carousal/stories/NSCarousal.stories.tsx +14 -11
  27. package/src/common/cart-icon/NsCartIcon.stories.tsx +9 -5
  28. package/src/common/checkbox/NsCheckbox.stories.tsx +15 -7
  29. package/src/common/checkbox/NsCheckbox.styled.tsx +1 -1
  30. package/src/common/checkbox/NsCheckbox.tsx +37 -40
  31. package/src/common/checkbox/index.ts +1 -1
  32. package/src/common/dropdown/NsDropdown.spec.tsx +125 -0
  33. package/src/common/dropdown/NsDropdown.styled.tsx +63 -0
  34. package/src/common/dropdown/NsDropdown.tsx +67 -0
  35. package/src/common/dropdown/NsDropdownOption.tsx +24 -0
  36. package/src/common/dropdown/index.ts +3 -0
  37. package/src/common/dropdown/stories/NsDropdown.stories.tsx +63 -0
  38. package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +63 -0
  39. package/src/common/dropdown/types.d.ts +23 -0
  40. package/src/common/flag/NsFlag.stories.tsx +9 -6
  41. package/src/common/flag/index.ts +1 -1
  42. package/src/common/icon/IconMap.ts +10 -0
  43. package/src/common/icon/NsIcon.stories.tsx +12 -5
  44. package/src/common/icon/NsIcon.styled.tsx +2 -2
  45. package/src/common/icon/NsIcon.tsx +10 -3
  46. package/src/common/icon/icons/ArrowDown.tsx +18 -0
  47. package/src/common/icon/icons/ArrowUp.tsx +18 -0
  48. package/src/common/icon/icons/SearchIcon.tsx +29 -0
  49. package/src/common/icon/icons/SlashIcon.tsx +17 -0
  50. package/src/common/icon/icons/home.tsx +16 -0
  51. package/src/common/icon/icons/search.svg +3 -0
  52. package/src/common/icon/types.d.ts +8 -1
  53. package/src/common/image/NsImage.spec.tsx +10 -0
  54. package/src/common/image/NsImage.stories.tsx +46 -0
  55. package/src/common/image/NsImage.tsx +18 -0
  56. package/src/common/image/NsNextImage.spec.tsx +10 -0
  57. package/src/common/image/NsNextImage.stories.tsx +51 -0
  58. package/src/common/image/NsNextImage.tsx +12 -0
  59. package/src/common/image/index.ts +3 -0
  60. package/src/common/image/types.d.ts +27 -0
  61. package/src/common/index.ts +7 -21
  62. package/src/common/input/InputFieldWrapper.tsx +15 -2
  63. package/src/common/input/InputWrapper.tsx +30 -25
  64. package/src/common/input/NsInputField.stories.tsx +41 -31
  65. package/src/common/input/NsInputField.tsx +73 -8
  66. package/src/common/input/getAdornmentProps.tsx +19 -3
  67. package/src/common/input/types.d.ts +15 -1
  68. package/src/common/label/NsLabel.stories.tsx +22 -17
  69. package/src/common/label/NsLabel.tsx +1 -1
  70. package/src/common/label/types.d.ts +1 -1
  71. package/src/common/link/NsLink.spec.tsx +1 -1
  72. package/src/common/link/NsLink.stories.tsx +17 -10
  73. package/src/common/link/index.ts +1 -1
  74. package/src/common/nav-product-card/NsNavProductCard.spec.tsx +1 -1
  75. package/src/common/nav-product-card/NsNavProductCard.stories.tsx +13 -7
  76. package/src/common/nav-product-card/NsNavProductCard.tsx +5 -5
  77. package/src/common/nav-product-card/index.ts +1 -1
  78. package/src/common/nav-tab/NsNavTab.stories.tsx +11 -7
  79. package/src/common/nav-tab/NsNavTab.tsx +3 -3
  80. package/src/common/nav-tab/index.ts +1 -1
  81. package/src/common/typography/GlobalFontInter.tsx +13 -0
  82. package/src/common/typography/NsTypography.spec.tsx +7 -7
  83. package/src/common/typography/NsTypography.stories.tsx +13 -9
  84. package/src/common/typography/Typography.styled.tsx +1 -13
  85. package/src/common/typography/index.ts +3 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,60 @@
1
+ # [1.0.0-cft-35.10](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/compare/v1.0.0-cft-35.9...v1.0.0-cft-35.10) (2023-04-25)
2
+
3
+
4
+ ### Chore
5
+
6
+ * adding NsInput and NsLabel publish code ([5887e0e](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/5887e0e33115b2ecd1729fd34a59db3f14b3bd57))
7
+ * Breadcrumb file export update ([1cc2fa3](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/1cc2fa346aa6df0a4c8d288fc39702fd247fa71c))
8
+ * CX130-156 refactoring library exports ([71a8677](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/71a8677420bc32f9976d8537f5c416e0a425a6f7))
9
+ * CX130-167 addressing review comments ([4c51c64](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/4c51c6445e17bf8062f47983cdf39ac3c0461ecd))
10
+ * CX130-196 commenting nsNextImage from stories ([f969a9d](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/f969a9d621ccee1df10d380d46f8e5fe696c0268))
11
+ * downgrading storybook to 6.5 ([b6fc98d](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/b6fc98d6a9beb166822f3b4b28d39602e0bbaa3d))
12
+ * fix test failures. CX130-196 ([3758a2d](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/3758a2d2ee79cc2f0c18d4a147254088b7c77859))
13
+ * fixing pipeline ([79126db](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/79126db24aa01d9d1288bb5de6c56805cb88e64d))
14
+ * fixing pipeline ([5bdbfd1](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/5bdbfd1bd91329e26e58f619b464964690ce811f))
15
+ * fixing pipeline ([615a6d8](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/615a6d8de9ba7db89db23e4473589fdf2f808779))
16
+ * fixing typo ([e4e4e4a](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/e4e4e4a78883b9bb421a511ac518576647bbfede))
17
+ * refactored code ([b30c0e0](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/b30c0e0bdf21e4c78e4e3c84bd9e13c431059976))
18
+ * typo fix ([13a4fc9](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/13a4fc926492f5868de958258a59587927c62ee7))
19
+ * updating types for NsInputField and NsLabel to omit unwanted ([69971ff](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/69971ffda98cb6b5eec5c9b7d5428341a56b9fa2))
20
+
21
+ ### Fix
22
+
23
+ * exported auth dropdown ([bd86d69](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/bd86d6990bcb7f3a490916c4ea9f1d17c407e724))
24
+ * NsDropdownoption background color ([55f6f17](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/55f6f17edce7a9220a692947810a9fae9428f996))
25
+ * Prerelease pipeline ([307c9f8](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/307c9f829cafbad3bd50289b2a313df81c546dc0))
26
+ * Used pallette color ([7eca719](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/7eca7195dcc486347e1d4b4bb861ebc8cd68e9ac))
27
+
28
+ ### FIX
29
+
30
+ * checking if updated yarn.lock fixes pipeline ([dd9c83e](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/dd9c83e29ce33ce5ed2bc77ffb15203688af9603))
31
+
32
+ ### New
33
+
34
+ * adding helper text to NsInputField ([63bc8d4](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/63bc8d4fc55442694eeea0cb544fba42e2873e1f))
35
+ * CX130-156 adding initial commit for NsNextImage component ([80da6bc](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/80da6bcc9c548d5aaba22b2199560eab17b622bf))
36
+ * Implemented SignIn/SignUp dropdown ([f6f9975](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/f6f99759f37c3a715b38b4137fcf2612460dca0b))
37
+ * Pr comments updated ([0ca6082](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/0ca6082461a0d20d72b5d54817cdf6093312ea93))
38
+ * pull file updataion ([53e1333](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/53e1333b55384111e17ed52c5e0a53986dc74eb4))
39
+
40
+ ### NEW
41
+
42
+ * NS video comonent ([6d48788](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/6d4878865ac6a93e6fb4fd305603ba116f5c8db9))
43
+
44
+ ### Update
45
+
46
+ * Chore CX130-156 updating NsImage and ([1073241](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/10732415c81bb8bdba14912df08ad6a1732fb764))
47
+ * CX130-129 adding search icon ([a31c55d](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/a31c55d0d36cc31e7e1503413b26136660f92bb7))
48
+ * CX130-196 updated storybook version from 6 to 7 and ([eba08e5](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/eba08e5287c11ad00f7f6835332bb98bda09866b))
49
+
50
+ # [1.0.0-cft-35.9](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/compare/v1.0.0-cft-35.8...v1.0.0-cft-35.9) (2023-04-20)
51
+
52
+
53
+ ### New
54
+
55
+ * Breadcrum ui ([33d6cc8](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/33d6cc8eb2a535965582b91e26f0196f17b930d8))
56
+ * NsBreadcrumb ui ([e40b089](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/e40b089376db9cf37af7d59b2022972f17c333ad))
57
+
1
58
  # [1.0.0-cft-35.8](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/compare/v1.0.0-cft-35.7...v1.0.0-cft-35.8) (2023-04-10)
2
59
 
3
60
 
@@ -10,7 +67,7 @@
10
67
  * button import name chnaged ([47522e3](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/47522e3f8c2e940ac720d204d69448a0b46442ce))
11
68
  * conflict ([971e4a5](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/971e4a50c88a545f2890a62349f2ebd06759384a))
12
69
  * merge issue ([67a72ce](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/67a72ce440c27b88a339e68f4c74a39c1c23b9a1))
13
- * Typography and banner ui updates ([99a8322](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/99a8322c968c9b31dca4bc1d0d3652d47a65338b))
70
+ * NsTypography and banner ui updates ([99a8322](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/99a8322c968c9b31dca4bc1d0d3652d47a65338b))
14
71
 
15
72
  ### FIX
16
73
 
@@ -76,7 +133,7 @@
76
133
 
77
134
  ### Chore
78
135
 
79
- * CFT-64 jest tests for Typography, BrandComponent and Icons ([eb9bfac](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/eb9bfac26f46ba051b2e0a598a7ad623b4405ba7))
136
+ * CFT-64 jest tests for NsTypography, BrandComponent and Icons ([eb9bfac](https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/commit/eb9bfac26f46ba051b2e0a598a7ad623b4405ba7))
80
137
 
81
138
  ### Docs
82
139
 
@@ -112,7 +169,7 @@ uses the format from [Project Changelog](https://code.tls.nuskin.io/ns-am/ux/des
112
169
 
113
170
  ### New
114
171
 
115
- * Added Typography component with storybook
172
+ * Added NsTypography component with storybook
116
173
  * Added Button component with storybook and jest
117
174
  * Added Brand component with storybook
118
175
 
package/package.json CHANGED
@@ -1,92 +1,92 @@
1
1
  {
2
- "name": "@nuskin/foundation-ui-components",
3
- "version": "1.0.0-cft-35.8",
4
- "description": "It is a foundation library written in react, that provides commom components to all UI pages",
5
- "private": false,
6
- "main": "src/common/index.ts",
7
- "repository": {
8
- "type": "git",
9
- "url": "git@code.tls.nuskin.io:ns-am/content-foundation/foundation-ui-components.git"
10
- },
11
- "homepage": "https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/blob/master/README.md",
12
- "author": {
13
- "email": "rpalanisamy@nuskin.com",
14
- "name": "Ruthraj Palanisamy"
15
- },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "keywords": [
20
- "react",
21
- "foundation-ui",
22
- "foundation-ui-components"
23
- ],
24
- "license": "MIT",
25
- "scripts": {
26
- "dev": "next dev",
27
- "build": "next build",
28
- "start": "next start",
29
- "lint": "next lint",
30
- "storybook": "start-storybook -p 6007",
31
- "test": "jest",
32
- "test:coverage": "yarn test --coverage",
33
- "test:watch": "jest --watch",
34
- "build-storybook": "build-storybook"
35
- },
36
- "dependencies": {
37
- "@emotion/react": "^11.10.6",
38
- "@emotion/styled": "^11.10.6",
39
- "@mui/icons-material": "^5.11.11",
40
- "@mui/material": "5.4.2",
41
- "@next/font": "13.2.4",
42
- "@nuskin/foundation-theme": "1.0.0-cft-33.12",
43
- "@types/jest": "^29.5.0",
44
- "framer-motion": "^10.8.5",
45
- "next": "13.2.4",
46
- "react": "18.2.0",
47
- "react-dom": "18.2.0",
48
- "react-material-ui-carousel": "^3.4.2",
49
- "react-slick": "^0.29.0",
50
- "slick-carousel": "^1.8.1",
51
- "typescript": "4.9.5"
52
- },
53
- "devDependencies": {
54
- "@babel/core": "^7.21.0",
55
- "@babel/preset-env": "^7.20.2",
56
- "@babel/preset-react": "^7.18.6",
57
- "@babel/preset-typescript": "^7.21.0",
58
- "@emotion/jest": "^11.10.5",
59
- "@nuskin/eslint-config": "^1.0.0-setup.1",
60
- "@storybook/addon-actions": "^6.5.16",
61
- "@storybook/addon-essentials": "^6.5.16",
62
- "@storybook/addon-interactions": "^6.5.16",
63
- "@storybook/addon-links": "^6.5.16",
64
- "@storybook/builder-webpack5": "^6.5.16",
65
- "@storybook/manager-webpack5": "^6.5.16",
66
- "@storybook/react": "^6.5.16",
67
- "@storybook/testing-library": "^0.0.13",
68
- "@testing-library/jest-dom": "^5.16.5",
69
- "@testing-library/react": "^14.0.0",
70
- "@types/lodash": "^4.14.191",
71
- "@types/node": "18.15.0",
72
- "@types/react": "18.0.28",
73
- "@types/react-dom": "18.0.11",
74
- "@types/react-slick": "^0.23.10",
75
- "@types/react-test-renderer": "^18.0.0",
76
- "@types/testing-library__jest-dom": "^5.14.5",
77
- "babel-jest": "^29.5.0",
78
- "babel-loader": "^9.1.2",
79
- "babel-plugin-emotion": "^11.0.0",
80
- "eslint": "8.36.0",
81
- "eslint-config-next": "13.2.4",
82
- "eslint-config-prettier": "^8.7.0",
83
- "eslint-plugin-json": "^3.1.0",
84
- "eslint-plugin-prettier": "^4.2.1",
85
- "eslint-plugin-storybook": "^0.6.11",
86
- "jest": "^29.5.0",
87
- "jest-environment-jsdom": "^29.5.0"
88
- },
89
- "files": [
90
- "src/common"
91
- ]
2
+ "name": "@nuskin/foundation-ui-components",
3
+ "version": "1.0.0-cft-35.10",
4
+ "description": "It is a foundation library written in react, that provides commom components to all UI pages",
5
+ "private": false,
6
+ "main": "src/common/index.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git@code.tls.nuskin.io:ns-am/content-foundation/foundation-ui-components.git"
10
+ },
11
+ "homepage": "https://code.tls.nuskin.io/ns-am/content-foundation/foundation-ui-components/blob/master/README.md",
12
+ "author": {
13
+ "email": "rpalanisamy@nuskin.com",
14
+ "name": "Ruthraj Palanisamy"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "keywords": [
20
+ "react",
21
+ "foundation-ui",
22
+ "foundation-ui-components"
23
+ ],
24
+ "license": "MIT",
25
+ "scripts": {
26
+ "dev": "next dev",
27
+ "build": "next build",
28
+ "start": "next start",
29
+ "lint": "next lint",
30
+ "storybook": "start-storybook -p 6007",
31
+ "test": "jest",
32
+ "test:coverage": "yarn test --coverage",
33
+ "test:watch": "jest --watch",
34
+ "build-storybook": "build-storybook"
35
+ },
36
+ "dependencies": {
37
+ "@emotion/react": "^11.10.6",
38
+ "@emotion/styled": "^11.10.6",
39
+ "@mui/icons-material": "^5.11.11",
40
+ "@mui/material": "5.4.2",
41
+ "@next/font": "13.2.4",
42
+ "@nuskin/foundation-theme": "1.0.0-cft-33.12",
43
+ "@types/jest": "^29.5.0",
44
+ "framer-motion": "^10.8.5",
45
+ "next": "13.2.4",
46
+ "react": "18.2.0",
47
+ "react-dom": "18.2.0",
48
+ "react-material-ui-carousel": "^3.4.2",
49
+ "react-slick": "^0.29.0",
50
+ "slick-carousel": "^1.8.1",
51
+ "typescript": "4.9.5"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/core": "^7.21.0",
55
+ "@babel/preset-env": "^7.20.2",
56
+ "@babel/preset-react": "^7.18.6",
57
+ "@babel/preset-typescript": "^7.21.0",
58
+ "@emotion/jest": "^11.10.5",
59
+ "@nuskin/eslint-config": "^1.0.0-setup.1",
60
+ "@storybook/addon-actions": "^6.5.16",
61
+ "@storybook/addon-essentials": "^6.5.16",
62
+ "@storybook/addon-interactions": "^6.5.16",
63
+ "@storybook/addon-links": "^6.5.16",
64
+ "@storybook/builder-webpack5": "^6.5.16",
65
+ "@storybook/manager-webpack5": "^6.5.16",
66
+ "@storybook/react": "^6.5.16",
67
+ "@storybook/testing-library": "^0.0.13",
68
+ "@testing-library/jest-dom": "^5.16.5",
69
+ "@testing-library/react": "^14.0.0",
70
+ "@types/lodash": "^4.14.191",
71
+ "@types/node": "18.15.0",
72
+ "@types/react": "18.0.28",
73
+ "@types/react-dom": "18.0.11",
74
+ "@types/react-slick": "^0.23.10",
75
+ "@types/react-test-renderer": "^18.0.0",
76
+ "@types/testing-library__jest-dom": "^5.14.5",
77
+ "babel-jest": "^29.5.0",
78
+ "babel-loader": "^9.1.2",
79
+ "babel-plugin-emotion": "^11.0.0",
80
+ "eslint": "8.36.0",
81
+ "eslint-config-next": "13.2.4",
82
+ "eslint-config-prettier": "^8.7.0",
83
+ "eslint-plugin-json": "^3.1.0",
84
+ "eslint-plugin-prettier": "^4.2.1",
85
+ "eslint-plugin-storybook": "^0.6.11",
86
+ "jest": "^29.5.0",
87
+ "jest-environment-jsdom": "^29.5.0"
88
+ },
89
+ "files": [
90
+ "src/common"
91
+ ]
92
92
  }
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { render, fireEvent, screen } from '../../../test-utils';
3
+ import { NsAuthDropdown } from './';
4
+
5
+ describe('NsAuthDropdown', () => {
6
+ const props = {
7
+ signInRedirectLink: '/signIn',
8
+ signUpRedirectLink: '/signUp',
9
+ signInBtnText: 'Sign In',
10
+ signUpLinkText: 'Sign Up',
11
+ signUpLinkPrefixText: 'Do not have an account?',
12
+ titleText: 'Welcome',
13
+ closeOnMouseLeave: false,
14
+ };
15
+
16
+ it('should render component with title text', () => {
17
+ render(<NsAuthDropdown {...props} />);
18
+ expect(screen.getByText('Welcome')).toBeInTheDocument();
19
+ });
20
+
21
+ it('should render the sign in button with text', () => {
22
+ render(<NsAuthDropdown {...props} />);
23
+ const authHead = screen.getByTestId('auth-head');
24
+ fireEvent.click(authHead);
25
+ expect(screen.getByTestId('sign-in-btn')).toBeInTheDocument();
26
+ expect(screen.getByTestId('sign-in-btn')).toHaveTextContent('Sign In');
27
+ });
28
+
29
+ it('should have the correct href attribute in SignUpLink', () => {
30
+ render(<NsAuthDropdown {...props} />);
31
+ const authHead = screen.getByTestId('auth-head');
32
+ fireEvent.click(authHead);
33
+ const signUpLink = screen.getByTestId('signup-link');
34
+ expect(signUpLink).toHaveAttribute('href', '/signUp');
35
+ });
36
+ });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { NsAuthDropdown } from './';
4
+
5
+ export default {
6
+ title: 'Components/NsAuthDropdown',
7
+ component: NsAuthDropdown,
8
+ decorators: [(story) => <div style={{ textAlign: 'center', marginTop: '20px' }}>{story()}</div>],
9
+ argTypes: {},
10
+ args: {
11
+ signInRedirectLink: '/signIn',
12
+ signUpRedirectLink: '/signUp',
13
+ signInBtnText: 'Sign In',
14
+ signUpLinkText: 'Sign up today!',
15
+ signUpLinkPrefixText: 'New customer?',
16
+ titleText: 'SIGN UP / SIGN IN',
17
+ closeOnMouseLeave: true,
18
+ },
19
+ } as ComponentMeta<typeof NsAuthDropdown>;
20
+
21
+ export const AuthDropdown: ComponentStory<typeof NsAuthDropdown> = (args) => <NsAuthDropdown {...args} />;
@@ -0,0 +1,118 @@
1
+ import { styled, ColorUtils } from '@nuskin/foundation-theme';
2
+ import { getAppColor } from '@nuskin/foundation-theme/src/utils/color-utils';
3
+ const { getPaletteColor } = ColorUtils;
4
+
5
+ const MAGENTA_COLOR = '#bb29bb';
6
+
7
+ export const AuthDropdownContainer = styled.div`
8
+ position: relative;
9
+ display: inline-block;
10
+ `;
11
+
12
+ export const AuthDropdown = styled.div`
13
+ min-width: 280px;
14
+ background-color: white;
15
+ color: black;
16
+ text-align: center;
17
+ padding: 5px 0;
18
+ position: absolute;
19
+ z-index: 600;
20
+ top: calc(100% + 18px);
21
+ right: 5%;
22
+ box-shadow: 0 0 5px 0 ${({ theme }) => getAppColor(theme, 'neutral', '20')};
23
+ transition: all 0.15s ease-in-out;
24
+ padding: 25px;
25
+ `;
26
+
27
+ export const Triangle = styled.div`
28
+ position: absolute;
29
+ bottom: -18px;
30
+ left: 50%;
31
+ width: 24px;
32
+ height: 24px;
33
+ overflow: hidden;
34
+ transition: all 0.15s ease-in-out;
35
+ z-index: 700;
36
+ opacity: 1;
37
+ &::after {
38
+ content: '';
39
+ position: absolute;
40
+ width: 14px;
41
+ height: 14px;
42
+ background-color: ${({ theme }) => getAppColor(theme, 'primary', 'white')};
43
+ transform: rotate(45deg);
44
+ top: 17px;
45
+ left: 5px;
46
+ box-shadow: 0 0 5px 0 ${({ theme }) => getAppColor(theme, 'neutral', '20')};
47
+ }
48
+ `;
49
+
50
+ export const AuthHead = styled.div`
51
+ cursor: pointer;
52
+ padding: 5px 10px;
53
+ display: flex;
54
+ justify-content: space-between;
55
+ align-items: center;
56
+ color: ${({ theme }) => getPaletteColor(theme, 'primary')};
57
+ `;
58
+
59
+ export const Button = styled.div`
60
+ padding-right: 10px;
61
+ `;
62
+
63
+ export const Link = styled.a`
64
+ text-decoration: none;
65
+ `;
66
+
67
+ export const SignInButton = styled(Link)`
68
+ display: block;
69
+ padding: 13px;
70
+ width: 100%;
71
+ background-color: ${MAGENTA_COLOR};
72
+ color: ${({ theme }) => getAppColor(theme, 'primary', 'white')};
73
+ border: 0;
74
+ font-size: 16px;
75
+ &:hover {
76
+ background-color: ${({ theme }) => getAppColor(theme, 'neutral', '70')};
77
+ }
78
+ `;
79
+
80
+ export const SignUpLinkContainer = styled.div`
81
+ margin-top: 15px;
82
+ color: ${({ theme }) => getAppColor(theme, 'primary', 'main')};
83
+ font-size: 13px;
84
+ line-height: 16px;
85
+ text-align: left;
86
+ `;
87
+
88
+ export const SignUpLink = styled(Link)`
89
+ cursor: pointer;
90
+ font-weight: 300;
91
+ font-size: 13px;
92
+ line-height: 16px;
93
+ text-decoration: none;
94
+ color: ${MAGENTA_COLOR};
95
+ position: relative;
96
+ transition: all 0.15s ease-in-out;
97
+ &:hover {
98
+ color: ${({ theme }) => getAppColor(theme, 'neutral', '70')};
99
+ font-size: 14px;
100
+ }
101
+ &:hover::after {
102
+ opacity: 1;
103
+ visibility: visible;
104
+ }
105
+ &::after {
106
+ content: '';
107
+ position: absolute;
108
+ bottom: -2px;
109
+ left: 0;
110
+ right: 0;
111
+ width: 100%;
112
+ height: 1px;
113
+ background-color: ${MAGENTA_COLOR};
114
+ transition: all 0.15s ease-in-out;
115
+ opacity: 0;
116
+ visibility: hidden;
117
+ }
118
+ `;
@@ -0,0 +1,62 @@
1
+ import { useState } from 'react';
2
+ import { NsIcon } from '../icon';
3
+ import {
4
+ AuthDropdownContainer,
5
+ AuthHead,
6
+ Button,
7
+ AuthDropdown,
8
+ Triangle,
9
+ SignInButton,
10
+ SignUpLinkContainer,
11
+ SignUpLink,
12
+ } from './NsAuthDropdown.styled';
13
+ import { NsAuthDropdownProps } from './types';
14
+
15
+ const NsAuthDropdown = ({
16
+ signInRedirectLink,
17
+ signUpRedirectLink,
18
+ signInBtnText,
19
+ signUpLinkText,
20
+ signUpLinkPrefixText,
21
+ titleText,
22
+ closeOnMouseLeave = false,
23
+ }: NsAuthDropdownProps) => {
24
+ const [isOpen, setIsOpen] = useState(false);
25
+
26
+ const handleToggle = () => {
27
+ setIsOpen((prevIsOpen) => !prevIsOpen);
28
+ };
29
+
30
+ const closeDropdown = () => {
31
+ if (closeOnMouseLeave) {
32
+ setIsOpen(false);
33
+ }
34
+ };
35
+
36
+ return (
37
+ <AuthDropdownContainer>
38
+ <AuthHead data-testid="auth-head" onClick={handleToggle}>
39
+ <Button>{titleText}</Button>
40
+ <NsIcon testId="chevron-icon" name={isOpen ? 'arrowDown' : 'arrowUp'} color="primary" />
41
+ {isOpen ? (
42
+ <div onMouseLeave={closeDropdown}>
43
+ <Triangle />
44
+ <AuthDropdown>
45
+ <SignInButton href={signInRedirectLink} data-testid="sign-in-btn">
46
+ {signInBtnText}
47
+ </SignInButton>
48
+ <SignUpLinkContainer>
49
+ {signUpLinkPrefixText}{' '}
50
+ <SignUpLink data-testid="signup-link" href={signUpRedirectLink}>
51
+ {signUpLinkText}
52
+ </SignUpLink>
53
+ </SignUpLinkContainer>
54
+ </AuthDropdown>
55
+ </div>
56
+ ) : null}
57
+ </AuthHead>
58
+ </AuthDropdownContainer>
59
+ );
60
+ };
61
+
62
+ export default NsAuthDropdown;
@@ -0,0 +1,2 @@
1
+ export { default as NsAuthDropdown } from './NsAuthDropdown';
2
+ export type { NsAuthDropdownProps } from './types';
@@ -0,0 +1,9 @@
1
+ export type NsAuthDropdownProps = {
2
+ signInRedirectLink: string;
3
+ signUpRedirectLink: string;
4
+ signInBtnText: string;
5
+ signUpLinkText: string;
6
+ signUpLinkPrefixText: string;
7
+ titleText: string;
8
+ closeOnMouseLeave?: boolean;
9
+ };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
- import NsBanner from './';
3
+ import { NsBanner } from './';
4
4
 
5
5
  describe('Hero component', () => {
6
6
  it('renders banner image and title', () => {
@@ -5,16 +5,18 @@
5
5
  */
6
6
 
7
7
  import React from 'react';
8
- import { ComponentStory, ComponentMeta } from '@storybook/react';
8
+ import type { StoryObj, Meta } from '@storybook/react';
9
+ import { NsBanner, NsTypography, NsButton } from '../';
10
+ import { CenterStoryDecorator } from '../../stories/CenterStoryDecorator';
9
11
 
10
- import Banner from './';
11
- import Typography from '../typography';
12
- import Button from '../button/NsButton';
12
+ type ComponentType = typeof NsBanner;
13
+ type Story = StoryObj<ComponentType>;
14
+ type MetaStory = Meta<ComponentType>;
13
15
 
14
16
  export default {
15
- title: 'Components',
16
- component: Banner,
17
- decorators: [(story) => <div style={{ textAlign: 'center', marginTop: '20px' }}>{story()}</div>],
17
+ title: 'Components/NsBanner',
18
+ component: NsBanner,
19
+ decorators: [CenterStoryDecorator],
18
20
  argTypes: {
19
21
  children: {
20
22
  control: 'text', // use the text control to edit children prop
@@ -27,16 +29,16 @@ export default {
27
29
  justify: 'start',
28
30
  children: (
29
31
  <div>
30
- <Typography className="w-80" variant="h1" colorOverride="#000000">
32
+ <NsTypography className="w-80" variant="h1" colorOverride="#000000">
31
33
  Limited time offers on LumiSpa iO cleansers and bundles!
32
- </Typography>
33
- <Typography variant="p-m" className="my-5" colorOverride="#000000">
34
+ </NsTypography>
35
+ <NsTypography variant="p-m" className="my-5" colorOverride="#000000">
34
36
  Learn more about what I do and how I can help you
35
- </Typography>
36
- <Button variant="contained">Contact me</Button>
37
+ </NsTypography>
38
+ <NsButton variant="contained">Contact me</NsButton>
37
39
  </div>
38
40
  ),
39
41
  },
40
- } as ComponentMeta<typeof Banner>;
42
+ } as MetaStory;
41
43
 
42
- export const NsBanner: ComponentStory<typeof Banner> = (args) => <Banner {...args} />;
44
+ export const DefaultNsBanner: Story = {};
@@ -1 +1,2 @@
1
- export { default } from './NsBanner';
1
+ export { default as NsBanner } from './NsBanner';
2
+ export type { NsBannerProps } from './types';
@@ -1,15 +1,15 @@
1
- import React from 'react';
2
- import { ComponentStory, ComponentMeta } from '@storybook/react';
3
- import NsBrandComponent from './NsBrandComponent';
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { NsBrandComponent } from './';
3
+ import { CenterStoryDecorator } from '../../stories/CenterStoryDecorator';
4
+
5
+ type ComponentType = typeof NsBrandComponent;
6
+ type Story = StoryObj<ComponentType>;
7
+ type MetaStory = Meta<ComponentType>;
4
8
 
5
9
  export default {
6
10
  title: 'Components/NsBrandComponent',
7
11
  component: NsBrandComponent,
8
- decorators: [
9
- (story) => (
10
- <div style={{ textAlign: 'center', marginTop: '20px' }}>{story()}</div>
11
- ),
12
- ],
12
+ decorators: [CenterStoryDecorator],
13
13
  argTypes: {
14
14
  size: { control: 'text', defaultValue: '100px' },
15
15
  variant: {
@@ -21,8 +21,6 @@ export default {
21
21
  size: '100px',
22
22
  variant: 'stacked',
23
23
  },
24
- } as ComponentMeta<typeof NsBrandComponent>;
24
+ } as MetaStory;
25
25
 
26
- export const Brand: ComponentStory<typeof NsBrandComponent> = (args) => (
27
- <NsBrandComponent {...args} />
28
- );
26
+ export const Brand: Story = {};
@@ -1,2 +1,2 @@
1
- export { default } from './NsBrandComponent';
2
- export type { NsBrandComponentProps } from './types';
1
+ export { default as NsBrandComponent } from './NsBrandComponent';
2
+ export type { NsBrandComponentProps } from './types';