@agilant/toga-blox 1.0.5
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.
- package/Dockerfile +9 -0
- package/README.md +69 -0
- package/assets/Logo.png +0 -0
- package/assets/compass-card-image-2.png +0 -0
- package/assets/compass-card-image-3.png +0 -0
- package/assets/compass-card-image-4.png +0 -0
- package/assets/compass-card-image.png +0 -0
- package/assets/compass-logo.png +0 -0
- package/assets/compass-tech-hero-bg.png +0 -0
- package/assets/contact-image.png +0 -0
- package/assets/green-laptop.png +0 -0
- package/assets/heroImage.png +0 -0
- package/assets/placeholder-no-image-available.png +0 -0
- package/assets/team.png +0 -0
- package/declarations.d.ts +4 -0
- package/docker-compose.yml +22 -0
- package/global.css +4 -0
- package/index.js +4 -0
- package/nodemon.json +5 -0
- package/package.json +70 -0
- package/postcss.config.js +6 -0
- package/src/components/Badge/Badge.stories.tsx +284 -0
- package/src/components/Badge/Badge.test.tsx +185 -0
- package/src/components/Badge/Badge.tsx +137 -0
- package/src/components/Badge/Badge.types.tsx +28 -0
- package/src/components/Badge/badgeClassNames.tsx +152 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +91 -0
- package/src/components/Card/Card.test.tsx +53 -0
- package/src/components/Card/Card.tsx +30 -0
- package/src/components/Card/Card.types.ts +11 -0
- package/src/components/Card/DUMMYPRODUCTDATA.json +670 -0
- package/src/components/Card/cardClassNames.ts +49 -0
- package/src/components/Card/index.ts +3 -0
- package/src/components/Card/templates/CompassCardTemplate.tsx +58 -0
- package/src/components/Card/templates/HorizontalCardTemplate.tsx +184 -0
- package/src/components/Card/templates/VerticalCardTemplate.tsx +154 -0
- package/src/components/Footer/ContactInfoItem.tsx +20 -0
- package/src/components/Footer/DUMMYFOOTERDATA.json +132 -0
- package/src/components/Footer/Footer.stories.tsx +292 -0
- package/src/components/Footer/Footer.test.tsx +90 -0
- package/src/components/Footer/Footer.tsx +159 -0
- package/src/components/Footer/Footer.types.tsx +61 -0
- package/src/components/Footer/footerClassNames.tsx +57 -0
- package/src/components/FormButton/FormButton.stories.tsx +199 -0
- package/src/components/FormButton/FormButton.test.tsx +73 -0
- package/src/components/FormButton/FormButton.tsx +116 -0
- package/src/components/FormButton/FormButton.types.ts +32 -0
- package/src/components/FormButton/formButtonClassNames.tsx +153 -0
- package/src/components/FormButton/index.ts +2 -0
- package/src/components/GenericList/DUMMYLISTDATA.json +560 -0
- package/src/components/GenericList/GenericList.stories.tsx +104 -0
- package/src/components/GenericList/GenericList.test.tsx +29 -0
- package/src/components/GenericList/GenericList.tsx +146 -0
- package/src/components/GenericList/genericListClassNames.tsx +8 -0
- package/src/components/GenericList/templates/DummyDataList.tsx +23 -0
- package/src/components/GenericList/templates/DynamicIconList.tsx +74 -0
- package/src/components/HamburgerButton/HamburgerButton.tsx +68 -0
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +6 -0
- package/src/components/HamburgerButton/index.ts +2 -0
- package/src/components/Header/DUMMYICONDATA.json +136 -0
- package/src/components/Header/Header.stories.tsx +521 -0
- package/src/components/Header/Header.test.tsx +323 -0
- package/src/components/Header/Header.tsx +289 -0
- package/src/components/Header/Header.types.ts +52 -0
- package/src/components/Header/headerClassNames.tsx +50 -0
- package/src/components/Header/headerContext.tsx +125 -0
- package/src/components/Header/index.ts +2 -0
- package/src/components/Hero/Hero.stories.tsx +69 -0
- package/src/components/Hero/Hero.test.tsx +109 -0
- package/src/components/Hero/Hero.tsx +58 -0
- package/src/components/Hero/Hero.types.ts +9 -0
- package/src/components/Hero/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +227 -0
- package/src/components/Icon/Icon.test.tsx +53 -0
- package/src/components/Icon/Icon.tsx +208 -0
- package/src/components/Icon/Icon.types.ts +24 -0
- package/src/components/Icon/iconClassNames.ts +79 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +79 -0
- package/src/components/Image/Image.test.tsx +87 -0
- package/src/components/Image/Image.tsx +49 -0
- package/src/components/Image/Image.types.ts +11 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +651 -0
- package/src/components/Input/Input.test.tsx +90 -0
- package/src/components/Input/Input.tsx +226 -0
- package/src/components/Input/Input.types.ts +52 -0
- package/src/components/Input/InputMemoTypes.tsx +32 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Input/inputClassNames.tsx +169 -0
- package/src/components/MobileMenu/MobileMenu.tsx +41 -0
- package/src/components/MobileMenu/MobileMenu.types.tsx +30 -0
- package/src/components/MobileMenu/index.ts +2 -0
- package/src/components/Nav/DUMMYNAVDATA.json +234 -0
- package/src/components/Nav/Nav.stories.tsx +181 -0
- package/src/components/Nav/Nav.test.tsx +89 -0
- package/src/components/Nav/Nav.tsx +242 -0
- package/src/components/Nav/Nav.types.tsx +35 -0
- package/src/components/Nav/index.ts +2 -0
- package/src/components/Nav/navClassNames.tsx +192 -0
- package/src/components/Page/TableDataDummy.tsx +216 -0
- package/src/components/Page/ViewPageTemplate.stories.tsx +546 -0
- package/src/components/Page/ViewPageTemplate.test.tsx +361 -0
- package/src/components/Page/ViewPageTemplate.tsx +10 -0
- package/src/components/Page/ViewPageTemplate.types.ts +6 -0
- package/src/components/Page/index.ts +2 -0
- package/src/components/PageSection/PageSection.stories.tsx +114 -0
- package/src/components/PageSection/PageSection.tsx +12 -0
- package/src/components/PageSection/PageSection.types.ts +6 -0
- package/src/components/PageSection/PageSections.test.tsx +88 -0
- package/src/components/PageSection/index.ts +2 -0
- package/src/components/Text/Text.stories.tsx +60 -0
- package/src/components/Text/Text.test.tsx +52 -0
- package/src/components/Text/Text.tsx +80 -0
- package/src/components/Text/Text.types.ts +12 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Toaster/Toaster.stories.tsx +122 -0
- package/src/components/Toaster/Toaster.test.tsx +61 -0
- package/src/components/Toaster/Toaster.tsx +80 -0
- package/src/components/Toaster/Toaster.types.ts +12 -0
- package/src/components/Toaster/index.ts +2 -0
- package/src/hoc/index.ts +2 -0
- package/src/hoc/styling/withStoryBook.tsx +19 -0
- package/src/main.css +3 -0
- package/src/setupTests.ts +1 -0
- package/src/userHoc/index.ts +1 -0
- package/src/userHoc/withMemo.tsx +20 -0
- package/src/utils/assertTagName.tsx +7 -0
- package/src/utils/generateAccordionItem.tsx +102 -0
- package/src/utils/generateFooterContacts.tsx +75 -0
- package/src/utils/generateNavMenu.tsx +54 -0
- package/src/utils/generateSocialList.tsx +34 -0
- package/src/utils/getFontAwesomeIcon.tsx +25 -0
- package/src/utils/inputValidation.tsx +26 -0
- package/tailwind.config.js +32 -0
- package/tsconfig.json +25 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DUMMYNAVDATA": [
|
|
3
|
+
{
|
|
4
|
+
"id": "1",
|
|
5
|
+
"title": "About",
|
|
6
|
+
"to": "",
|
|
7
|
+
"links": [
|
|
8
|
+
{
|
|
9
|
+
"menuItem": "Features",
|
|
10
|
+
"link": "#",
|
|
11
|
+
"src": null,
|
|
12
|
+
"alt": ""
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"menuItem": "Pricing",
|
|
16
|
+
"link": "#",
|
|
17
|
+
"src": null,
|
|
18
|
+
"alt": ""
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"menuItem": "Support",
|
|
22
|
+
"link": "#",
|
|
23
|
+
"src": null,
|
|
24
|
+
"alt": ""
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"menuItem": "Forums",
|
|
28
|
+
"link": "#",
|
|
29
|
+
"src": null,
|
|
30
|
+
"alt": ""
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": 2,
|
|
36
|
+
"title": "Projects",
|
|
37
|
+
"to": "",
|
|
38
|
+
"links": [
|
|
39
|
+
{
|
|
40
|
+
"menuItem": "Contribute",
|
|
41
|
+
"link": "#",
|
|
42
|
+
"src": null,
|
|
43
|
+
"alt": ""
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"menuItem": "Media assets",
|
|
47
|
+
"link": "#",
|
|
48
|
+
"src": null,
|
|
49
|
+
"alt": ""
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"menuItem": "Changelog",
|
|
53
|
+
"link": "#",
|
|
54
|
+
"src": null,
|
|
55
|
+
"alt": ""
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"menuItem": "Releases",
|
|
59
|
+
"link": "#",
|
|
60
|
+
"src": null,
|
|
61
|
+
"alt": ""
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"menuItem": "Upcoming",
|
|
65
|
+
"link": "#",
|
|
66
|
+
"src": null,
|
|
67
|
+
"alt": ""
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"menuItem": "Past",
|
|
71
|
+
"link": "#",
|
|
72
|
+
"src": null,
|
|
73
|
+
"alt": ""
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"menuItem": "Extra",
|
|
77
|
+
"link": "#",
|
|
78
|
+
"src": null,
|
|
79
|
+
"alt": ""
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"menuItem": "Extra Two",
|
|
83
|
+
"link": "#",
|
|
84
|
+
"src": null,
|
|
85
|
+
"alt": ""
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": 3,
|
|
91
|
+
"title": "Community",
|
|
92
|
+
"to": "fake link",
|
|
93
|
+
"links": [
|
|
94
|
+
{
|
|
95
|
+
"menuItem": "Join Discord",
|
|
96
|
+
"link": "#",
|
|
97
|
+
"src": null,
|
|
98
|
+
"alt": ""
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"menuItem": "Follow on Twitter",
|
|
102
|
+
"link": "#",
|
|
103
|
+
"src": null,
|
|
104
|
+
"alt": ""
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"menuItem": "Email newsletter",
|
|
108
|
+
"link": "#",
|
|
109
|
+
"src": null,
|
|
110
|
+
"alt": ""
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"menuItem": "GitHub discussions",
|
|
114
|
+
"link": "#",
|
|
115
|
+
"src": null,
|
|
116
|
+
"alt": ""
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": 4,
|
|
122
|
+
"title": "Store",
|
|
123
|
+
"to": "",
|
|
124
|
+
"links": [
|
|
125
|
+
{
|
|
126
|
+
"menuItem": "Computers",
|
|
127
|
+
"link": "#",
|
|
128
|
+
"src": null,
|
|
129
|
+
"alt": ""
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"menuItem": "IpadsIpadsIpadsIpadsIpadsIpadsIpadsIpads",
|
|
133
|
+
"link": "#",
|
|
134
|
+
"src": null,
|
|
135
|
+
"alt": ""
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"menuItem": "Accessories",
|
|
139
|
+
"link": "#",
|
|
140
|
+
"src": null,
|
|
141
|
+
"alt": ""
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"DUMMYCOMPASSNAVDATA": [
|
|
147
|
+
{
|
|
148
|
+
"id": "1",
|
|
149
|
+
"title": "Products",
|
|
150
|
+
"to": "",
|
|
151
|
+
"links": [
|
|
152
|
+
{
|
|
153
|
+
"menuItem": "Features",
|
|
154
|
+
"link": "#",
|
|
155
|
+
"src": null,
|
|
156
|
+
"alt": ""
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"menuItem": "Pricing",
|
|
160
|
+
"link": "#",
|
|
161
|
+
"src": null,
|
|
162
|
+
"alt": ""
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"menuItem": "Support",
|
|
166
|
+
"link": "#",
|
|
167
|
+
"src": null,
|
|
168
|
+
"alt": ""
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"menuItem": "Forums",
|
|
172
|
+
"link": "#",
|
|
173
|
+
"src": null,
|
|
174
|
+
"alt": ""
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": 2,
|
|
180
|
+
"title": "Kits",
|
|
181
|
+
"to": "",
|
|
182
|
+
"links": [
|
|
183
|
+
{
|
|
184
|
+
"menuItem": "Contribute",
|
|
185
|
+
"link": "#",
|
|
186
|
+
"src": null,
|
|
187
|
+
"alt": ""
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"menuItem": "Media assets",
|
|
191
|
+
"link": "#",
|
|
192
|
+
"src": null,
|
|
193
|
+
"alt": ""
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"menuItem": "Changelog",
|
|
197
|
+
"link": "#",
|
|
198
|
+
"src": null,
|
|
199
|
+
"alt": ""
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"menuItem": "Releases",
|
|
203
|
+
"link": "#",
|
|
204
|
+
"src": null,
|
|
205
|
+
"alt": ""
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"menuItem": "Upcoming",
|
|
209
|
+
"link": "#",
|
|
210
|
+
"src": null,
|
|
211
|
+
"alt": ""
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"menuItem": "Past",
|
|
215
|
+
"link": "#",
|
|
216
|
+
"src": null,
|
|
217
|
+
"alt": ""
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"menuItem": "Extra",
|
|
221
|
+
"link": "#",
|
|
222
|
+
"src": null,
|
|
223
|
+
"alt": ""
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"menuItem": "Extra Two",
|
|
227
|
+
"link": "#",
|
|
228
|
+
"src": null,
|
|
229
|
+
"alt": ""
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
2
|
+
import Nav, { NavTypes } from ".";
|
|
3
|
+
import { DUMMYCOMPASSNAVDATA } from "./DUMMYNAVDATA.json";
|
|
4
|
+
|
|
5
|
+
import { withStoryBook } from "../../hoc";
|
|
6
|
+
|
|
7
|
+
// Wrap your component with the HOC
|
|
8
|
+
const StoryBookViewNav = withStoryBook(Nav);
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Components/Nav",
|
|
12
|
+
argTypes: {
|
|
13
|
+
navBackgroundColor: {
|
|
14
|
+
control: {
|
|
15
|
+
type: "color",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
navData: {
|
|
19
|
+
table: {
|
|
20
|
+
disable: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
parentHoverBackground: {
|
|
24
|
+
control: {
|
|
25
|
+
type: "select",
|
|
26
|
+
},
|
|
27
|
+
options: ["blue", "green", "grey", "white", "none"],
|
|
28
|
+
},
|
|
29
|
+
parentHoverFontColor: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "select",
|
|
32
|
+
},
|
|
33
|
+
options: ["blue", "green", "white", "black"],
|
|
34
|
+
},
|
|
35
|
+
parentHoverUnderline: {
|
|
36
|
+
control: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
parentHoverBorderColor: {
|
|
41
|
+
control: {
|
|
42
|
+
type: "select",
|
|
43
|
+
},
|
|
44
|
+
options: ["blue", "green", "grey", "black", "none"],
|
|
45
|
+
},
|
|
46
|
+
parentBackground: {
|
|
47
|
+
control: {
|
|
48
|
+
type: "select",
|
|
49
|
+
},
|
|
50
|
+
options: ["blue", "green", "grey", "black", "white", "none"],
|
|
51
|
+
},
|
|
52
|
+
parentBorderColor: {
|
|
53
|
+
control: {
|
|
54
|
+
type: "select",
|
|
55
|
+
},
|
|
56
|
+
options: ["blue", "green", "grey", "black", "none"],
|
|
57
|
+
},
|
|
58
|
+
parentShape: {
|
|
59
|
+
control: {
|
|
60
|
+
type: "select",
|
|
61
|
+
},
|
|
62
|
+
options: ["cornered", "semiRounded", "rounded"],
|
|
63
|
+
},
|
|
64
|
+
parentTextSize: {
|
|
65
|
+
control: "select",
|
|
66
|
+
options: ["xs", "sm", "md", "lg"],
|
|
67
|
+
description: "The font size for the parent menu item text.",
|
|
68
|
+
},
|
|
69
|
+
parentTextColor: {
|
|
70
|
+
control: {
|
|
71
|
+
type: "select",
|
|
72
|
+
},
|
|
73
|
+
options: ["black", "white"],
|
|
74
|
+
},
|
|
75
|
+
includeSubmenuImages: {
|
|
76
|
+
control: {
|
|
77
|
+
type: "boolean",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
submenuTextSize: {
|
|
81
|
+
control: "select",
|
|
82
|
+
options: ["xs", "sm", "md", "lg"],
|
|
83
|
+
description: "The font size for the submenu text.",
|
|
84
|
+
},
|
|
85
|
+
submenuBackgroundColor: {
|
|
86
|
+
control: {
|
|
87
|
+
type: "select",
|
|
88
|
+
},
|
|
89
|
+
options: ["blue", "green", "grey", "white", "none"],
|
|
90
|
+
},
|
|
91
|
+
submenuHoverBackground: {
|
|
92
|
+
control: {
|
|
93
|
+
type: "select",
|
|
94
|
+
},
|
|
95
|
+
options: ["blue", "green", "grey", "white", "none"],
|
|
96
|
+
},
|
|
97
|
+
submenuHoverTextColor: {
|
|
98
|
+
control: {
|
|
99
|
+
type: "select",
|
|
100
|
+
},
|
|
101
|
+
options: ["black", "white"],
|
|
102
|
+
},
|
|
103
|
+
submenuTextColor: {
|
|
104
|
+
control: {
|
|
105
|
+
type: "select",
|
|
106
|
+
},
|
|
107
|
+
options: ["black", "white"],
|
|
108
|
+
},
|
|
109
|
+
submenuHoverBorderStyle: {
|
|
110
|
+
control: {
|
|
111
|
+
type: "select",
|
|
112
|
+
},
|
|
113
|
+
options: ["top-bottom", "right-left", "bottom", "none"],
|
|
114
|
+
},
|
|
115
|
+
submenuHoverBorderColor: {
|
|
116
|
+
control: {
|
|
117
|
+
type: "select",
|
|
118
|
+
},
|
|
119
|
+
options: ["blue", "green", "black", "none"],
|
|
120
|
+
},
|
|
121
|
+
mobileBreakpoint: {
|
|
122
|
+
control: {
|
|
123
|
+
type: "select",
|
|
124
|
+
},
|
|
125
|
+
options: ["small", "medium", "large", "extraLarge"],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
} as Meta<NavTypes>;
|
|
129
|
+
|
|
130
|
+
const Template: StoryFn<typeof StoryBookViewNav> = (args) => (
|
|
131
|
+
<StoryBookViewNav
|
|
132
|
+
{...args}
|
|
133
|
+
storybookStyle={{
|
|
134
|
+
backgroundColor: args.navBackgroundColor,
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
export const Default = Template.bind({});
|
|
140
|
+
Default.args = {
|
|
141
|
+
navBackgroundColor: "#a7d2ff",
|
|
142
|
+
|
|
143
|
+
parentHoverBackground: "none",
|
|
144
|
+
parentHoverFontColor: "black",
|
|
145
|
+
parentHoverUnderline: true,
|
|
146
|
+
parentHoverBorderColor: "black",
|
|
147
|
+
parentShape: "cornered",
|
|
148
|
+
parentBackground: "none",
|
|
149
|
+
parentBorderColor: "none",
|
|
150
|
+
parentTextSize: "md",
|
|
151
|
+
|
|
152
|
+
includeSubmenuImages: false,
|
|
153
|
+
submenuBackgroundColor: "blue",
|
|
154
|
+
submenuHoverBackground: "white",
|
|
155
|
+
|
|
156
|
+
mobileBreakpoint: "small",
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const Compass = Template.bind({});
|
|
160
|
+
Compass.args = {
|
|
161
|
+
navBackgroundColor: "#00b9a8",
|
|
162
|
+
navData: DUMMYCOMPASSNAVDATA,
|
|
163
|
+
parentHoverBackground: "none",
|
|
164
|
+
parentHoverFontColor: "black",
|
|
165
|
+
parentHoverUnderline: true,
|
|
166
|
+
parentHoverBorderColor: "none",
|
|
167
|
+
|
|
168
|
+
parentShape: "cornered",
|
|
169
|
+
parentBackground: "none",
|
|
170
|
+
parentBorderColor: "none",
|
|
171
|
+
parentTextColor: "white",
|
|
172
|
+
parentTextSize: "lg",
|
|
173
|
+
|
|
174
|
+
includeSubmenuImages: true,
|
|
175
|
+
submenuBackgroundColor: "white",
|
|
176
|
+
submenuHoverBackground: "white",
|
|
177
|
+
submenuHoverBorderStyle: "top-bottom",
|
|
178
|
+
submenuHoverBorderColor: "green",
|
|
179
|
+
|
|
180
|
+
mobileBreakpoint: "small",
|
|
181
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import "../../../dist/main.css";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { describe, test, expect, beforeEach } from "vitest";
|
|
4
|
+
|
|
5
|
+
import Nav from "./Nav";
|
|
6
|
+
import { DUMMYNAVDATA } from "./DUMMYNAVDATA.json";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
describe("<Nav /> without submenu images", () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
render(
|
|
12
|
+
<Nav
|
|
13
|
+
navData={DUMMYNAVDATA}
|
|
14
|
+
navBackgroundColor={"gray"}
|
|
15
|
+
parentBackground={"grey"}
|
|
16
|
+
parentBorderColor={"none"}
|
|
17
|
+
parentShape={"cornered"}
|
|
18
|
+
parentTextColor={"black"}
|
|
19
|
+
parentTextSize={"sm"}
|
|
20
|
+
parentHoverBackground={"black"}
|
|
21
|
+
parentHoverFontColor={"white"}
|
|
22
|
+
parentHoverUnderline={true}
|
|
23
|
+
parentHoverBorderColor={"none"}
|
|
24
|
+
submenuBackgroundColor={"blue"}
|
|
25
|
+
submenuTextColor={"white"}
|
|
26
|
+
submenuTextSize={"text-base"}
|
|
27
|
+
submenuHoverBackground={"blue"}
|
|
28
|
+
submenuHoverTextColor={"white"}
|
|
29
|
+
submenuHoverBorderStyle={"border-b"}
|
|
30
|
+
submenuHoverBorderColor={"black"}
|
|
31
|
+
mobileBreakpoint={"medium"}
|
|
32
|
+
accordionParentStyle={"border-b border-black p-2 w-full"}
|
|
33
|
+
accordionExpandedStyle={"w-full py-3"}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("renders Nav component", () => {
|
|
39
|
+
expect(screen.getByTestId("nav")).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("ul element has correct classes and aria-label", () => {
|
|
43
|
+
const ulElement = screen.getByTestId("main-menu");
|
|
44
|
+
expect(ulElement).toHaveAttribute("aria-label", "Main Menu");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("nav has correct mobile breakpoint", () => {
|
|
48
|
+
const nav = screen.getByTestId("main-menu");
|
|
49
|
+
expect(nav).toHaveClass("max-md:hidden");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("correct number of parent menu items are rendered", () => {
|
|
53
|
+
const parentMenuItems = screen.getAllByTestId("parent-menu-item");
|
|
54
|
+
expect(parentMenuItems).toHaveLength(DUMMYNAVDATA.length);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("renders correct parent menu button text", () => {
|
|
58
|
+
const parentMenuItemAbout = screen.getByTestId("parent-button-About");
|
|
59
|
+
expect(parentMenuItemAbout).toBeInTheDocument();
|
|
60
|
+
expect(parentMenuItemAbout).toHaveTextContent("About");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("renders correct parent menu background color", () => {
|
|
64
|
+
const parentMenuItemAbout = screen.getByTestId("parent-button-About");
|
|
65
|
+
expect(parentMenuItemAbout).toHaveClass("bg-gray-800");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("renders correct parent linked menu item text", () => {
|
|
69
|
+
const parentMenuItemCommunity = screen.getByTestId("parent-link-Community");
|
|
70
|
+
expect(parentMenuItemCommunity).toBeInTheDocument();
|
|
71
|
+
expect(parentMenuItemCommunity).toHaveTextContent("Community");
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("parent linked menu item has correct link", () => {
|
|
75
|
+
const parentMenuItemCommunity = screen.getByTestId("parent-link-Community")
|
|
76
|
+
expect(parentMenuItemCommunity).toHaveAttribute("href", "fake link");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test("accordion component is rendered", () => {
|
|
80
|
+
const accordion = screen.getByTestId("accordion-nav");
|
|
81
|
+
expect(accordion).toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("accordion nav has correct mobile breakpoint", () => {
|
|
85
|
+
const nav = screen.getByTestId("accordion-nav");
|
|
86
|
+
expect(nav).toHaveClass("max-md:flex");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
});
|