@agilant/toga-blox 1.0.5 → 1.0.7
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/.gitattributes +5 -0
- package/README.md +3 -1
- package/package.json +15 -14
- package/src/components/Badge/Badge.stories.tsx +175 -126
- package/src/components/Badge/Badge.test.tsx +20 -29
- package/src/components/Badge/Badge.tsx +44 -57
- package/src/components/Badge/Badge.types.tsx +18 -9
- package/src/components/Badge/badgeClassNames.tsx +40 -19
- package/src/components/Card/templates/HorizontalCardTemplate.tsx +5 -5
- package/src/components/Card/templates/VerticalCardTemplate.tsx +5 -5
- package/src/components/CounterButton/CounterButton.stories.tsx +91 -0
- package/src/components/CounterButton/CounterButton.tsx +100 -0
- package/src/components/CounterButton/CounterButton.types.ts +12 -0
- package/src/components/FormButton/FormButton.stories.tsx +282 -67
- package/src/components/FormButton/FormButton.test.tsx +4 -4
- package/src/components/FormButton/FormButton.tsx +45 -67
- package/src/components/FormButton/FormButton.types.ts +8 -7
- package/src/components/Header/Header.stories.tsx +20 -23
- package/src/components/Header/Header.test.tsx +0 -1
- package/src/components/Hero/Hero.tsx +3 -3
- package/src/components/Icon/Icon.stories.tsx +12 -12
- package/src/components/Icon/Icon.test.tsx +3 -3
- package/src/components/Icon/Icon.tsx +9 -9
- package/src/components/Image/Image.tsx +10 -12
- package/src/components/Image/declarations.d.ts +24 -0
- package/src/components/Input/Input.stories.tsx +116 -253
- package/src/components/Input/Input.test.tsx +4 -4
- package/src/components/Input/Input.tsx +5 -7
- package/src/components/Nav/DUMMYNAVDATA.json +1 -1
- package/src/components/Page/ViewPageTemplate.stories.tsx +77 -80
- package/src/components/Text/Text.stories.tsx +21 -31
- package/src/components/Text/Text.tsx +12 -63
- package/src/components/Text/Text.types.ts +4 -4
|
@@ -15,9 +15,9 @@ describe("<Input /> with all props", () => {
|
|
|
15
15
|
// LABEL
|
|
16
16
|
label={
|
|
17
17
|
<Text
|
|
18
|
-
size="md"
|
|
19
|
-
color="
|
|
20
|
-
fontFamily="serif"
|
|
18
|
+
size="text-md"
|
|
19
|
+
color="text-black"
|
|
20
|
+
fontFamily="font-serif"
|
|
21
21
|
text="Search for items"
|
|
22
22
|
tag="h2"
|
|
23
23
|
additionalClasses="mb-0 pb-2 pl-2"
|
|
@@ -48,7 +48,7 @@ describe("<Input /> with all props", () => {
|
|
|
48
48
|
text="Submit"
|
|
49
49
|
as="button"
|
|
50
50
|
hoverBackground="green"
|
|
51
|
-
|
|
51
|
+
backgroundColor="green"
|
|
52
52
|
icon={<FontAwesomeIcon icon={faCircleArrowRight} />}
|
|
53
53
|
fontColor="white"
|
|
54
54
|
additionalClasses="items-center px-4"
|
|
@@ -63,7 +63,7 @@ const Input: React.FC<InputTypes> = ({
|
|
|
63
63
|
text="Submit"
|
|
64
64
|
as="button"
|
|
65
65
|
hoverBackground="green"
|
|
66
|
-
|
|
66
|
+
backgroundColor="red"
|
|
67
67
|
icon={<FontAwesomeIcon icon={faCircleArrowRight} />}
|
|
68
68
|
fontColor="white"
|
|
69
69
|
borderColor="green"
|
|
@@ -158,11 +158,10 @@ const Input: React.FC<InputTypes> = ({
|
|
|
158
158
|
onChange={handleChange}
|
|
159
159
|
value={inputValue}
|
|
160
160
|
data-testid="input-element"
|
|
161
|
-
className={`block w-full border-2 p-2 ${inputTextClasses} ${inputWithButtonClasses} ${inputBackgroundClasses} ${inputPaddingClasses} ${
|
|
162
|
-
!hasValidation
|
|
161
|
+
className={`block w-full border-2 p-2 ${inputTextClasses} ${inputWithButtonClasses} ${inputBackgroundClasses} ${inputPaddingClasses} ${!hasValidation
|
|
163
162
|
? inputBorderColor
|
|
164
163
|
: inputBorderClasses
|
|
165
|
-
|
|
164
|
+
}`}
|
|
166
165
|
/>
|
|
167
166
|
</div>
|
|
168
167
|
|
|
@@ -196,11 +195,10 @@ const Input: React.FC<InputTypes> = ({
|
|
|
196
195
|
onChange={handleChange}
|
|
197
196
|
value={inputValue}
|
|
198
197
|
data-testid="input-element"
|
|
199
|
-
className={`block w-full border-2 ${inputTextClasses} ${inputShapeClasses} ${inputBackgroundClasses} ${inputPaddingClasses} ${
|
|
200
|
-
!hasValidation
|
|
198
|
+
className={`block w-full border-2 ${inputTextClasses} ${inputShapeClasses} ${inputBackgroundClasses} ${inputPaddingClasses} ${!hasValidation
|
|
201
199
|
? inputBorderColor
|
|
202
200
|
: inputBorderClasses
|
|
203
|
-
|
|
201
|
+
}`}
|
|
204
202
|
/>
|
|
205
203
|
{hasRightIcon && (
|
|
206
204
|
<div
|
|
@@ -35,8 +35,7 @@ export default {
|
|
|
35
35
|
description: "nodes that can be passed to the component",
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
// tags: ["autodocs"],
|
|
38
|
+
tags: ["autodocs"],
|
|
40
39
|
} as Meta;
|
|
41
40
|
|
|
42
41
|
const Template: StoryFn<typeof StorybookViewTemplatePage> = (args) => (
|
|
@@ -71,12 +70,12 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
71
70
|
hasNavItems={true}
|
|
72
71
|
hasMobileMenu={true}
|
|
73
72
|
logoBorderRadius={true}
|
|
74
|
-
logoHoverColor="blue"
|
|
75
|
-
backgroundColor="gray"
|
|
76
|
-
bottomBorderColor="black"
|
|
73
|
+
logoHoverColor="hover:bg-blue-500"
|
|
74
|
+
backgroundColor="bg-gray-500"
|
|
75
|
+
bottomBorderColor="border-black"
|
|
77
76
|
mobileOpenIcon={getFontAwesomeIcon("hamburger")}
|
|
78
77
|
mobileCloseIcon={getFontAwesomeIcon("x")}
|
|
79
|
-
mobileMenuBackground="blue"
|
|
78
|
+
mobileMenuBackground="bg-blue-500"
|
|
80
79
|
hasMobileIcons={true}
|
|
81
80
|
hasMobileNavItems={true}
|
|
82
81
|
hasMobileBadge={false}
|
|
@@ -96,10 +95,9 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
96
95
|
<Badge
|
|
97
96
|
type="href"
|
|
98
97
|
to="#"
|
|
99
|
-
color="blue"
|
|
100
|
-
hoverColor="blue"
|
|
101
|
-
borderColor="none"
|
|
102
|
-
tagStyle={false}
|
|
98
|
+
color="text-blue-500"
|
|
99
|
+
hoverColor="hover:text-blue-500"
|
|
100
|
+
borderColor="border-none"
|
|
103
101
|
mobileIcon={getFontAwesomeIcon("phone")}
|
|
104
102
|
mobileIconLabel="Contact Us"
|
|
105
103
|
onClick={() => alert("Redirect to Contact Us page")}
|
|
@@ -114,17 +112,17 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
114
112
|
text={
|
|
115
113
|
<>
|
|
116
114
|
<Text
|
|
117
|
-
size="sm"
|
|
118
|
-
color="
|
|
119
|
-
fontFamily="serif"
|
|
115
|
+
size="text-sm"
|
|
116
|
+
color="text-black"
|
|
117
|
+
fontFamily="font-serif"
|
|
120
118
|
text="Contact Us"
|
|
121
119
|
tag="h2"
|
|
122
120
|
additionalClasses="pl-2 pb-0 font-bold"
|
|
123
121
|
/>
|
|
124
122
|
<Text
|
|
125
|
-
size="xs"
|
|
126
|
-
color="
|
|
127
|
-
fontFamily="serif"
|
|
123
|
+
size="text-xs"
|
|
124
|
+
color="text-black"
|
|
125
|
+
fontFamily="font-serif"
|
|
128
126
|
text="1-800-800-8000"
|
|
129
127
|
tag="p"
|
|
130
128
|
additionalClasses="pl-2 pt-0"
|
|
@@ -146,20 +144,20 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
146
144
|
navData={DUMMYCOMPASSNAVDATA}
|
|
147
145
|
navBackgroundColor={"#FFFFF"}
|
|
148
146
|
parentHoverBackground={"none"}
|
|
149
|
-
parentHoverFontColor={"black"}
|
|
147
|
+
parentHoverFontColor={"text-black"}
|
|
150
148
|
parentHoverUnderline={true}
|
|
151
149
|
parentHoverBorderColor={"none"}
|
|
152
|
-
parentShape={"
|
|
150
|
+
parentShape={"rounded"}
|
|
153
151
|
parentBackground={"none"}
|
|
154
152
|
parentBorderColor={"none"}
|
|
155
|
-
submenuBackgroundColor={"white"}
|
|
156
|
-
submenuHoverBackground={"blue"}
|
|
153
|
+
submenuBackgroundColor={"bg-white"}
|
|
154
|
+
submenuHoverBackground={"hover:bg-blue-500"}
|
|
157
155
|
submenuHoverBorderStyle={"top-bottom"}
|
|
158
|
-
submenuHoverBorderColor={"blue"}
|
|
156
|
+
submenuHoverBorderColor={"border-blue-500"}
|
|
159
157
|
includeSubmenuImages={true}
|
|
160
158
|
mobileBreakpoint={"extraLarge"}
|
|
161
159
|
accordionParentStyle={
|
|
162
|
-
"
|
|
160
|
+
"rounded p-2 w-full border-b-2 border-b-blue-700 text-black"
|
|
163
161
|
}
|
|
164
162
|
accordionExpandedStyle={"pl-2 py-3"}
|
|
165
163
|
/>
|
|
@@ -170,18 +168,18 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
170
168
|
label={undefined}
|
|
171
169
|
inputType={"text"}
|
|
172
170
|
inputName={"search"}
|
|
173
|
-
borderColor="gray"
|
|
171
|
+
borderColor="border-gray-500"
|
|
174
172
|
hasPlaceholder
|
|
175
173
|
placeholder={"Search"}
|
|
176
174
|
hasButton
|
|
177
|
-
backgroundColor="white"
|
|
175
|
+
backgroundColor="bg-white"
|
|
178
176
|
additionalClasses="bg-blue-500"
|
|
179
177
|
button={
|
|
180
178
|
<FormButton
|
|
181
179
|
icon={getFontAwesomeIcon("search")}
|
|
182
|
-
|
|
183
|
-
hoverBackground="black"
|
|
184
|
-
hoverFontColor="white"
|
|
180
|
+
backgroundColor="bg-blue-500"
|
|
181
|
+
hoverBackground="hover:bg-black"
|
|
182
|
+
hoverFontColor="hover:text-white"
|
|
185
183
|
additionalClasses="h-full w-8 justify-center"
|
|
186
184
|
shape="none"
|
|
187
185
|
/>
|
|
@@ -195,7 +193,7 @@ ViewWithHeroAndCardsWithGlassHeader.args = {
|
|
|
195
193
|
<PageSection
|
|
196
194
|
key="pageSectionOne"
|
|
197
195
|
sectionContainerClasses="flex flex-col w-full h-full bg-slate-100 p-6
|
|
198
|
-
|
|
196
|
+
justify-center items-center max-sm:p-2 max-w-pageSectionMaxWidth mx-auto"
|
|
199
197
|
>
|
|
200
198
|
<GenericList
|
|
201
199
|
data={DUMMYCOMPASSPRODUCTDATA}
|
|
@@ -237,8 +235,8 @@ ViewWithTableAndTitle.args = {
|
|
|
237
235
|
<Hero key="hero" textAlignment={"left"} background="gradient" />,
|
|
238
236
|
<PageSection key="37">
|
|
239
237
|
<Text
|
|
240
|
-
size={"
|
|
241
|
-
color={"black"}
|
|
238
|
+
size={"text-2xl"}
|
|
239
|
+
color={"text-black"}
|
|
242
240
|
text={"Staff"}
|
|
243
241
|
fontFamily={""}
|
|
244
242
|
tag="h1"
|
|
@@ -278,12 +276,12 @@ CompassPageView.args = {
|
|
|
278
276
|
hasMobileMenu={true}
|
|
279
277
|
hasAnimatedHamburgerButton={true}
|
|
280
278
|
logoBorderRadius={true}
|
|
281
|
-
logoHoverColor="green"
|
|
282
|
-
backgroundColor="gray"
|
|
283
|
-
bottomBorderColor="green"
|
|
279
|
+
logoHoverColor="hover:bg-green-500"
|
|
280
|
+
backgroundColor="bg-gray-500"
|
|
281
|
+
bottomBorderColor="border-green-500"
|
|
284
282
|
mobileOpenIcon={getFontAwesomeIcon("hamburger")}
|
|
285
283
|
mobileCloseIcon={getFontAwesomeIcon("x")}
|
|
286
|
-
mobileMenuBackground="green"
|
|
284
|
+
mobileMenuBackground="bg-green-500"
|
|
287
285
|
hasMobileIcons={true}
|
|
288
286
|
hasMobileNavItems={true}
|
|
289
287
|
hasMobileBadge={false}
|
|
@@ -292,10 +290,9 @@ CompassPageView.args = {
|
|
|
292
290
|
<Badge
|
|
293
291
|
type="href"
|
|
294
292
|
to="#"
|
|
295
|
-
color="green"
|
|
296
|
-
hoverColor="green"
|
|
297
|
-
borderColor="none"
|
|
298
|
-
tagStyle={false}
|
|
293
|
+
color="text-green-500"
|
|
294
|
+
hoverColor="hover:text-green-500"
|
|
295
|
+
borderColor="border-none"
|
|
299
296
|
mobileIcon={getFontAwesomeIcon("phone")}
|
|
300
297
|
mobileIconLabel="Contact Us"
|
|
301
298
|
onClick={() => alert("Redirect to Contact Us page")}
|
|
@@ -310,17 +307,17 @@ CompassPageView.args = {
|
|
|
310
307
|
text={
|
|
311
308
|
<>
|
|
312
309
|
<Text
|
|
313
|
-
size="sm"
|
|
314
|
-
color="
|
|
315
|
-
fontFamily="serif"
|
|
310
|
+
size="text-sm"
|
|
311
|
+
color="text-black"
|
|
312
|
+
fontFamily="font-serif"
|
|
316
313
|
text="Contact Us"
|
|
317
314
|
tag="h2"
|
|
318
315
|
additionalClasses="pl-2 pb-0 font-bold"
|
|
319
316
|
/>
|
|
320
317
|
<Text
|
|
321
|
-
size="xs"
|
|
322
|
-
color="
|
|
323
|
-
fontFamily="serif"
|
|
318
|
+
size="text-xs"
|
|
319
|
+
color="text-black"
|
|
320
|
+
fontFamily="font-serif"
|
|
324
321
|
text="1-800-800-8000"
|
|
325
322
|
tag="p"
|
|
326
323
|
additionalClasses="pl-2 pt-0"
|
|
@@ -342,20 +339,20 @@ CompassPageView.args = {
|
|
|
342
339
|
navData={DUMMYCOMPASSNAVDATA}
|
|
343
340
|
navBackgroundColor={"#FFFFF"}
|
|
344
341
|
parentHoverBackground={"none"}
|
|
345
|
-
parentHoverFontColor={"black"}
|
|
342
|
+
parentHoverFontColor={"text-black"}
|
|
346
343
|
parentHoverUnderline={true}
|
|
347
344
|
parentHoverBorderColor={"none"}
|
|
348
|
-
parentShape={"
|
|
345
|
+
parentShape={"rounded"}
|
|
349
346
|
parentBackground={"none"}
|
|
350
347
|
parentBorderColor={"none"}
|
|
351
|
-
submenuBackgroundColor={"white"}
|
|
352
|
-
submenuHoverBackground={"green"}
|
|
348
|
+
submenuBackgroundColor={"bg-white"}
|
|
349
|
+
submenuHoverBackground={"hover:bg-green-500"}
|
|
353
350
|
submenuHoverBorderStyle={"top-bottom"}
|
|
354
|
-
submenuHoverBorderColor={"green"}
|
|
351
|
+
submenuHoverBorderColor={"border-green-500"}
|
|
355
352
|
includeSubmenuImages={true}
|
|
356
353
|
mobileBreakpoint={"extraLarge"}
|
|
357
354
|
accordionParentStyle={
|
|
358
|
-
"
|
|
355
|
+
"rounded p-2 w-full border-b-2 border-b-teal-700 text-black"
|
|
359
356
|
}
|
|
360
357
|
accordionExpandedStyle={"pl-2 py-3"}
|
|
361
358
|
/>
|
|
@@ -366,18 +363,18 @@ CompassPageView.args = {
|
|
|
366
363
|
label={undefined}
|
|
367
364
|
inputType={"text"}
|
|
368
365
|
inputName={"search"}
|
|
369
|
-
borderColor="gray"
|
|
366
|
+
borderColor="border-gray-500"
|
|
370
367
|
hasPlaceholder
|
|
371
368
|
placeholder={"Search"}
|
|
372
369
|
hasButton
|
|
373
|
-
backgroundColor="white"
|
|
370
|
+
backgroundColor="bg-white"
|
|
374
371
|
additionalClasses="bg-blue-500"
|
|
375
372
|
button={
|
|
376
373
|
<FormButton
|
|
377
374
|
icon={getFontAwesomeIcon("search")}
|
|
378
|
-
|
|
379
|
-
hoverBackground="black"
|
|
380
|
-
hoverFontColor="white"
|
|
375
|
+
backgroundColor="bg-green-500"
|
|
376
|
+
hoverBackground="hover:bg-black"
|
|
377
|
+
hoverFontColor="hover:text-white"
|
|
381
378
|
additionalClasses="h-full w-8 justify-center"
|
|
382
379
|
shape="none"
|
|
383
380
|
/>
|
|
@@ -394,9 +391,9 @@ CompassPageView.args = {
|
|
|
394
391
|
src="../../../assets/compass-tech-hero-bg.png"
|
|
395
392
|
text={
|
|
396
393
|
<Text
|
|
397
|
-
size="
|
|
398
|
-
color="white"
|
|
399
|
-
fontFamily="serif"
|
|
394
|
+
size="text-2xl"
|
|
395
|
+
color="text-white"
|
|
396
|
+
fontFamily="font-serif"
|
|
400
397
|
text="Equip your team with exactly what they need"
|
|
401
398
|
tag="h1"
|
|
402
399
|
additionalClasses="w-3/4 max-sm:text-xl max-sm:w-3/4"
|
|
@@ -406,12 +403,12 @@ CompassPageView.args = {
|
|
|
406
403
|
<PageSection
|
|
407
404
|
key="pageSection"
|
|
408
405
|
sectionContainerClasses="w-full bg-slate-100 flex flex-col p-6
|
|
409
|
-
|
|
406
|
+
justify-center items-center h-[100%]"
|
|
410
407
|
>
|
|
411
408
|
<Text
|
|
412
|
-
size="
|
|
413
|
-
color="black"
|
|
414
|
-
fontFamily="serif"
|
|
409
|
+
size="text-2xl"
|
|
410
|
+
color="text-black"
|
|
411
|
+
fontFamily="font-serif"
|
|
415
412
|
text="Kits"
|
|
416
413
|
tag="h2"
|
|
417
414
|
additionalClasses="my-4 max-sm:text-xl"
|
|
@@ -420,7 +417,7 @@ CompassPageView.args = {
|
|
|
420
417
|
<PageSection
|
|
421
418
|
key="pageSectionOne"
|
|
422
419
|
sectionContainerClasses="flex flex-col w-full h-full bg-slate-100 p-6
|
|
423
|
-
|
|
420
|
+
justify-center items-center max-sm:p-2 max-w-pageSectionMaxWidth mx-auto"
|
|
424
421
|
>
|
|
425
422
|
<GenericList
|
|
426
423
|
data={DUMMYCOMPASSPRODUCTDATA}
|
|
@@ -445,9 +442,9 @@ CompassPageView.args = {
|
|
|
445
442
|
</PageSection>
|
|
446
443
|
<PageSection sectionContainerClasses="flex w-full bg-yellow-400 flex p-6 justify-center items-center h-[100%] mt-6 max-sm:flex-col">
|
|
447
444
|
<Text
|
|
448
|
-
size="xl"
|
|
449
|
-
color="black"
|
|
450
|
-
fontFamily="serif"
|
|
445
|
+
size="text-xl"
|
|
446
|
+
color="text-black"
|
|
447
|
+
fontFamily="font-serif"
|
|
451
448
|
text="Help us improve your experience:"
|
|
452
449
|
tag="h2"
|
|
453
450
|
additionalClasses="p-6 max-sm:p-2 max-sm:text-lg"
|
|
@@ -461,14 +458,14 @@ CompassPageView.args = {
|
|
|
461
458
|
fontFamily={""}
|
|
462
459
|
/>
|
|
463
460
|
}
|
|
464
|
-
|
|
465
|
-
fontColor="white"
|
|
461
|
+
backgroundColor="bg-green-500"
|
|
462
|
+
fontColor="text-white"
|
|
466
463
|
size="md"
|
|
467
|
-
shape="
|
|
468
|
-
borderColor="none"
|
|
469
|
-
hoverBackground="green"
|
|
470
|
-
hoverFontColor="green"
|
|
471
|
-
hoverBorderColor="green"
|
|
464
|
+
shape="rounded"
|
|
465
|
+
borderColor="border-none"
|
|
466
|
+
hoverBackground="hover:bg-green-500"
|
|
467
|
+
hoverFontColor="hover:text-green-500"
|
|
468
|
+
hoverBorderColor="hover:border-green-500"
|
|
472
469
|
hoverUnderline={true}
|
|
473
470
|
onClick={() => alert("Button clicked!")}
|
|
474
471
|
as="a"
|
|
@@ -485,7 +482,7 @@ CompassPageView.args = {
|
|
|
485
482
|
}
|
|
486
483
|
title={
|
|
487
484
|
<Text
|
|
488
|
-
size={"xl"}
|
|
485
|
+
size={"text-xl"}
|
|
489
486
|
color={""}
|
|
490
487
|
text={"Compass Website"}
|
|
491
488
|
fontFamily={""}
|
|
@@ -495,7 +492,7 @@ CompassPageView.args = {
|
|
|
495
492
|
}
|
|
496
493
|
slogan={
|
|
497
494
|
<Text
|
|
498
|
-
size={"md"}
|
|
495
|
+
size={"text-md"}
|
|
499
496
|
color={""}
|
|
500
497
|
text={"Great slogan goes here."}
|
|
501
498
|
fontFamily={""}
|
|
@@ -506,7 +503,7 @@ CompassPageView.args = {
|
|
|
506
503
|
copyRightText={
|
|
507
504
|
<Text
|
|
508
505
|
size={"md"}
|
|
509
|
-
color={"black"}
|
|
506
|
+
color={"text-black"}
|
|
510
507
|
text="Copyright © 2024 - All right reserved by Generic Company"
|
|
511
508
|
fontFamily={""}
|
|
512
509
|
additionalClasses="text-center"
|
|
@@ -515,7 +512,7 @@ CompassPageView.args = {
|
|
|
515
512
|
socialTitle={
|
|
516
513
|
<Text
|
|
517
514
|
size={"md"}
|
|
518
|
-
color={"black"}
|
|
515
|
+
color={"text-black"}
|
|
519
516
|
text="Connect"
|
|
520
517
|
fontFamily={""}
|
|
521
518
|
additionalClasses="font-bold uppercase w-full"
|
|
@@ -524,7 +521,7 @@ CompassPageView.args = {
|
|
|
524
521
|
contactTitle={
|
|
525
522
|
<Text
|
|
526
523
|
size={"md"}
|
|
527
|
-
color={"black"}
|
|
524
|
+
color={"text-black"}
|
|
528
525
|
text="Contact Us:"
|
|
529
526
|
fontFamily={""}
|
|
530
527
|
additionalClasses="font-bold uppercase"
|
|
@@ -533,8 +530,8 @@ CompassPageView.args = {
|
|
|
533
530
|
logoBorderRadius={true}
|
|
534
531
|
hasNavItems={true}
|
|
535
532
|
hasSocial={true}
|
|
536
|
-
logoHoverColor="green"
|
|
537
|
-
backgroundColor="green"
|
|
533
|
+
logoHoverColor="hover:bg-green-500"
|
|
534
|
+
backgroundColor="bg-green-500"
|
|
538
535
|
accordionGap="gap-1"
|
|
539
536
|
copyRightTextPlacement="center"
|
|
540
537
|
socialPlacement="center"
|
|
@@ -1,60 +1,50 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
-
import Text
|
|
4
|
-
|
|
5
|
-
interface TextStoryProps extends TextTypes {
|
|
6
|
-
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
-
color: "red" | "blue" | "green" | "primary" | "slate";
|
|
8
|
-
as: "h1" | "h2" | "h3" | "h4" | "h5" | "p";
|
|
9
|
-
fontFamily: "sans" | "mono" | "serif";
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
2
|
+
import Text from "./Text";
|
|
3
|
+
import { TextTypes } from "./Text.types";
|
|
12
4
|
|
|
13
5
|
export default {
|
|
14
6
|
title: "Components/Text",
|
|
15
7
|
component: Text,
|
|
16
8
|
argTypes: {
|
|
17
9
|
size: {
|
|
18
|
-
control: "
|
|
19
|
-
|
|
20
|
-
description: "The font size for the text.",
|
|
10
|
+
control: "none",
|
|
11
|
+
description: "The font size for the text. Use Tailwind CSS classes like 'text-xs', 'text-sm', 'text-md', 'text-lg', 'text-xl', 'text-2xl', 'text-3xl'. Default is 'text-base'.",
|
|
21
12
|
},
|
|
22
13
|
color: {
|
|
23
|
-
control: "
|
|
24
|
-
|
|
25
|
-
description: "The color of the text.",
|
|
14
|
+
control: "none",
|
|
15
|
+
description: "The color of the text. Use Tailwind CSS classes like 'text-red-800', 'text-blue-800', 'text-green-800', 'text-slate-950', 'text-black', etc. Default is 'text-black'.",
|
|
26
16
|
},
|
|
27
17
|
tag: {
|
|
28
|
-
control: "
|
|
29
|
-
|
|
30
|
-
description: "The type of HTML element the text should be.",
|
|
18
|
+
control: "none",
|
|
19
|
+
description: "The type of HTML element the text should be. Options include 'h1', 'h2', 'h3', 'h4', 'h5', 'p', 'span'. Default is 'span'.",
|
|
31
20
|
},
|
|
32
21
|
fontFamily: {
|
|
33
|
-
control: "
|
|
34
|
-
|
|
35
|
-
description: "The type of font family.",
|
|
22
|
+
control: "none",
|
|
23
|
+
description: "The type of font family. Use Tailwind CSS classes like 'font-sans', 'font-mono', 'font-serif'. Default is 'font-sans'.",
|
|
36
24
|
},
|
|
37
25
|
text: {
|
|
38
|
-
control: "
|
|
39
|
-
description: "The main text displayed on the
|
|
26
|
+
control: "none",
|
|
27
|
+
description: "The main text displayed on the component.",
|
|
28
|
+
},
|
|
29
|
+
additionalClasses: {
|
|
30
|
+
control: "none",
|
|
31
|
+
description: "Additional Tailwind CSS classes to be added.",
|
|
40
32
|
},
|
|
41
33
|
},
|
|
42
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
43
34
|
tags: ["autodocs"],
|
|
44
35
|
parameters: {
|
|
45
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
46
36
|
layout: "centered",
|
|
47
37
|
},
|
|
48
|
-
} as Meta<
|
|
38
|
+
} as Meta<TextTypes>;
|
|
49
39
|
|
|
50
|
-
const Template: StoryFn<
|
|
40
|
+
const Template: StoryFn<TextTypes> = (args) => <Text {...args} />;
|
|
51
41
|
|
|
52
42
|
export const Primary = Template.bind({});
|
|
53
43
|
Primary.args = {
|
|
54
|
-
size: "
|
|
55
|
-
color: "
|
|
44
|
+
size: "text-2xl",
|
|
45
|
+
color: "text-blue-500",
|
|
56
46
|
tag: "h2",
|
|
57
|
-
fontFamily: "
|
|
47
|
+
fontFamily: "font-mono",
|
|
58
48
|
text: "Testing",
|
|
59
49
|
additionalClasses: "p-5",
|
|
60
50
|
};
|
|
@@ -1,77 +1,26 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { TextTypes } from "./Text.types";
|
|
3
3
|
|
|
4
|
-
const sizeClassesMap = {
|
|
5
|
-
xs: "text-xs",
|
|
6
|
-
sm: "text-sm",
|
|
7
|
-
md: "text-md",
|
|
8
|
-
lg: "text-lg",
|
|
9
|
-
xl: "text-xl",
|
|
10
|
-
xxl: "text-2xl",
|
|
11
|
-
xxxl: "text-3xl",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const colorClassesMap: { [key: string]: string } = {
|
|
15
|
-
slate: "text-slate-950",
|
|
16
|
-
red: "text-red-800",
|
|
17
|
-
blue: "text-blue-800",
|
|
18
|
-
green: "text-teal-800",
|
|
19
|
-
black: "text-slate-950",
|
|
20
|
-
white: "text-slate-100",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const fontFamilyMap = {
|
|
24
|
-
sans: "font-sans",
|
|
25
|
-
serif: "font-serif",
|
|
26
|
-
mono: "font-mono",
|
|
27
|
-
};
|
|
28
|
-
|
|
29
4
|
const Text: React.FC<TextTypes> = ({
|
|
30
|
-
size,
|
|
31
|
-
color = "
|
|
5
|
+
size = "text-base",
|
|
6
|
+
color = "text-black",
|
|
32
7
|
tag = "span",
|
|
33
8
|
text,
|
|
34
|
-
fontFamily = "sans",
|
|
35
|
-
additionalClasses,
|
|
9
|
+
fontFamily = "font-sans",
|
|
10
|
+
additionalClasses = "",
|
|
36
11
|
...props
|
|
37
12
|
}) => {
|
|
38
|
-
const
|
|
39
|
-
const textColorClasses = colorClassesMap[color];
|
|
40
|
-
const fontFamilyClasses =
|
|
41
|
-
fontFamilyMap[fontFamily as keyof typeof fontFamilyMap];
|
|
13
|
+
const ElementTag: React.ElementType = tag as keyof JSX.IntrinsicElements | React.ComponentType;
|
|
42
14
|
|
|
43
|
-
|
|
15
|
+
const className = `
|
|
16
|
+
${size}
|
|
17
|
+
${color}
|
|
18
|
+
${fontFamily}
|
|
44
19
|
${additionalClasses}
|
|
45
|
-
|
|
46
|
-
${textColorClasses}
|
|
47
|
-
${fontFamilyClasses}
|
|
48
|
-
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
// Fixing the TS error on TagName w/ adding type string triggered this error on ElementTag:
|
|
52
|
-
// The error message is indicating that a string value is not assignable to
|
|
53
|
-
// the type React.ElementType. This is because React.ElementType is expecting
|
|
54
|
-
// a React component, not a string. However, in React, a string can be used
|
|
55
|
-
// as a component if it represents a valid HTML tag.
|
|
56
|
-
|
|
57
|
-
// The issue here is that TypeScript is not correctly inferring the type of tag.
|
|
58
|
-
// You can solve this by explicitly telling TypeScript that tag can be a string
|
|
59
|
-
// representing a valid HTML tag or a React component. Here's how you can do it:
|
|
60
|
-
// This tells TypeScript that tag can be a string representing a valid HTML tag
|
|
61
|
-
// (like "span", "div", etc.) or a React component. This should solve your issue.
|
|
62
|
-
// If it doesn't, please provide more context or check the rest of
|
|
63
|
-
// your code for potential type mismatches.
|
|
64
|
-
|
|
65
|
-
// Solution:
|
|
66
|
-
const ElementTag: React.ElementType = tag as
|
|
67
|
-
| keyof JSX.IntrinsicElements
|
|
68
|
-
| React.ComponentType;
|
|
69
|
-
|
|
70
|
-
// Was previously:
|
|
71
|
-
// const ElementTag = tag ?? "span";
|
|
20
|
+
`;
|
|
72
21
|
|
|
73
22
|
return (
|
|
74
|
-
<ElementTag data-testid="text" className={
|
|
23
|
+
<ElementTag data-testid="text" className={className} {...props}>
|
|
75
24
|
{text}
|
|
76
25
|
</ElementTag>
|
|
77
26
|
);
|
|
@@ -3,10 +3,10 @@ import { ReactNode } from "react";
|
|
|
3
3
|
export type TagName = "span" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | string;
|
|
4
4
|
|
|
5
5
|
export interface TextTypes {
|
|
6
|
-
size
|
|
7
|
-
color
|
|
6
|
+
size?: string;
|
|
7
|
+
color?: string;
|
|
8
8
|
tag?: TagName;
|
|
9
9
|
text: ReactNode;
|
|
10
|
-
fontFamily
|
|
11
|
-
additionalClasses?: string
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
additionalClasses?: string;
|
|
12
12
|
}
|