@agilant/toga-blox 1.0.8 → 1.0.9
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/assets/cable.jpg +0 -0
- package/assets/card-1.jpg +0 -0
- package/assets/cat-logo.png +0 -0
- package/assets/item.jpg +0 -0
- package/assets/map.png +0 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +953 -0
- package/coverage/coverage-final.json +74 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +551 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/toga-blox-npm/index.html +131 -0
- package/coverage/toga-blox-npm/postcss.config.js.html +103 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.stories.tsx.html +793 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/components/Badge/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.stories.tsx.html +787 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.tsx.html +163 -0
- package/coverage/toga-blox-npm/src/components/Card/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CategoryCardTemplate.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CompassCardTemplate.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CounterContentCardTemplate.tsx.html +685 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/HorizontalCardTemplate.tsx.html +637 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ItemCardTemplate.tsx.html +550 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/KitContentCardTemplate.tsx.html +469 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ShippingAddressCardTemplate.tsx.html +418 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/VerticalCardTemplate.tsx.html +592 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/index.html +221 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.stories.tsx.html +358 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.tsx.html +385 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.stories.tsx.html +286 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.tsx.html +124 -0
- package/coverage/toga-blox-npm/src/components/Description/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.stories.tsx.html +676 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.tsx.html +346 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Footer/ContactInfoItem.tsx.html +139 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.stories.tsx.html +934 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/components/Footer/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.stories.tsx.html +952 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/FormButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.stories.tsx.html +376 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.tsx.html +520 -0
- package/coverage/toga-blox-npm/src/components/GenericList/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DummyDataList.tsx.html +154 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DynamicIconList.tsx.html +250 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.stories.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.tsx.html +262 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/Hamburger.stories.tsx.html +760 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/HamburgerButton.tsx.html +232 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.stories.tsx.html +1633 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.tsx.html +814 -0
- package/coverage/toga-blox-npm/src/components/Header/headerContext.tsx.html +460 -0
- package/coverage/toga-blox-npm/src/components/Header/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.stories.tsx.html +289 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Hero/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.stories.tsx.html +673 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.tsx.html +313 -0
- package/coverage/toga-blox-npm/src/components/IconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.stories.tsx.html +322 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.tsx.html +226 -0
- package/coverage/toga-blox-npm/src/components/Image/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.stories.tsx.html +1621 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.tsx.html +568 -0
- package/coverage/toga-blox-npm/src/components/Input/InputMemoTypes.tsx.html +181 -0
- package/coverage/toga-blox-npm/src/components/Input/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/MobileMenu.tsx.html +208 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/index.html +116 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.stories.tsx.html +628 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.tsx.html +622 -0
- package/coverage/toga-blox-npm/src/components/Nav/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Page/TableDataDummy.tsx.html +733 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.stories.tsx.html +1714 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.tsx.html +115 -0
- package/coverage/toga-blox-npm/src/components/Page/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.stories.tsx.html +433 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.tsx.html +121 -0
- package/coverage/toga-blox-npm/src/components/PageSection/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.stories.tsx.html +517 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.stories.tsx.html +349 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.tsx.html +502 -0
- package/coverage/toga-blox-npm/src/components/Slider/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AdminSubmenu.tsx.html +136 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenu.tsx.html +253 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenuItem.tsx.html +202 -0
- package/coverage/toga-blox-npm/src/components/Submenus/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.stories.tsx.html +235 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.tsx.html +172 -0
- package/coverage/toga-blox-npm/src/components/Text/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.stories.tsx.html +445 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.tsx.html +301 -0
- package/coverage/toga-blox-npm/src/components/Toaster/index.html +131 -0
- package/coverage/toga-blox-npm/src/hoc/styling/index.html +116 -0
- package/coverage/toga-blox-npm/src/hoc/styling/withStoryBook.tsx.html +142 -0
- package/coverage/toga-blox-npm/src/userHoc/index.html +116 -0
- package/coverage/toga-blox-npm/src/userHoc/withMemo.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/assertTagName.tsx.html +106 -0
- package/coverage/toga-blox-npm/src/utils/generateAccordionItem.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/utils/generateFooterContacts.tsx.html +295 -0
- package/coverage/toga-blox-npm/src/utils/generateNavMenu.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/utils/generateSocialList.tsx.html +187 -0
- package/coverage/toga-blox-npm/src/utils/getFontAwesomeIcon.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/index.html +206 -0
- package/coverage/toga-blox-npm/src/utils/inputValidation.tsx.html +163 -0
- package/coverage/toga-blox-npm/tailwind.config.js.html +205 -0
- package/declarations.d.ts +1 -1
- package/package.json +5 -6
- package/src/components/Badge/Badge.stories.tsx +110 -207
- package/src/components/Badge/Badge.test.tsx +40 -41
- package/src/components/Badge/Badge.tsx +29 -99
- package/src/components/Badge/Badge.types.tsx +12 -23
- package/src/components/Card/Card.stories.tsx +166 -22
- package/src/components/Card/Card.test.tsx +3 -3
- package/src/components/Card/Card.tsx +12 -16
- package/src/components/Card/DUMMYPRODUCTDATA.json +381 -225
- package/src/components/Card/templates/CategoryCardTemplate.tsx +86 -0
- package/src/components/Card/templates/CompassCardTemplate.tsx +1 -1
- package/src/components/Card/templates/CounterContentCardTemplate.tsx +200 -0
- package/src/components/Card/templates/ItemCardTemplate.tsx +155 -0
- package/src/components/Card/templates/KitContentCardTemplate.tsx +128 -0
- package/src/components/Card/templates/ShippingAddressCardTemplate.tsx +111 -0
- package/src/components/Card/templates/VerticalCardTemplate.tsx +100 -85
- package/src/components/CounterButton/CounterButton.tsx +1 -1
- package/src/components/Description/Description.stories.tsx +67 -0
- package/src/components/Description/Description.tsx +13 -0
- package/src/components/Description/Description.types.ts +9 -0
- package/src/components/DropDownIconButton/DropDownIconButton.stories.tsx +197 -0
- package/src/components/DropDownIconButton/DropDownIconButton.test.tsx +90 -0
- package/src/components/DropDownIconButton/DropDownIconButton.tsx +87 -0
- package/src/components/DropDownIconButton/DropDownIconButton.types.ts +21 -0
- package/src/components/DropDownIconButton/index.ts +2 -0
- package/src/components/Footer/ContactInfoItem.tsx +8 -10
- package/src/components/Footer/Footer.stories.tsx +13 -22
- package/src/components/Footer/Footer.tsx +25 -88
- package/src/components/Footer/Footer.types.tsx +2 -2
- package/src/components/FormButton/FormButton.stories.tsx +101 -226
- package/src/components/FormButton/FormButton.test.tsx +1 -1
- package/src/components/FormButton/FormButton.tsx +34 -42
- package/src/components/FormButton/FormButton.types.ts +7 -13
- package/src/components/GenericList/GenericList.stories.tsx +5 -12
- package/src/components/GenericList/GenericList.tsx +91 -92
- package/src/components/GenericList/templates/DynamicIconList.tsx +45 -64
- package/src/components/GetSupport/GetSupport.stories.tsx +80 -0
- package/src/components/GetSupport/GetSupport.test.tsx +62 -0
- package/src/components/GetSupport/GetSupport.tsx +59 -0
- package/src/components/GetSupport/GetSupport.types.ts +11 -0
- package/src/components/HamburgerButton/Hamburger.stories.tsx +225 -0
- package/src/components/HamburgerButton/HamburgerButton.tsx +37 -56
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +2 -1
- package/src/components/Header/Header.stories.tsx +3 -5
- package/src/components/Header/Header.tsx +37 -83
- package/src/components/Hero/Hero.stories.tsx +1 -2
- package/src/components/IconButton/IconButton.stories.tsx +196 -0
- package/src/components/{Icon/Icon.test.tsx → IconButton/IconButton.test.tsx} +3 -4
- package/src/components/IconButton/IconButton.tsx +76 -0
- package/src/components/IconButton/IconButton.types.ts +28 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +10 -12
- package/src/components/Input/Input.test.tsx +2 -3
- package/src/components/Input/Input.tsx +41 -104
- package/src/components/MobileMenu/MobileMenu.types.tsx +0 -2
- package/src/components/Nav/DUMMYNAVDATA.json +4 -4
- package/src/components/Nav/Nav.tsx +49 -112
- package/src/components/Nav/Nav.types.tsx +14 -2
- package/src/components/Page/ViewPageTemplate.stories.tsx +2 -2
- package/src/components/Page/ViewPageTemplate.test.tsx +1 -1
- package/src/components/Page/ViewPageTemplate.types.ts +1 -1
- package/src/components/PageSection/PageSection.stories.tsx +3 -1
- package/src/components/PageSection/PageSections.test.tsx +2 -1
- package/src/components/SearchInput/SearchInput.stories.tsx +144 -0
- package/src/components/SearchInput/SearchInput.tsx +81 -0
- package/src/components/SearchInput/SearchInput.types.ts +28 -0
- package/src/components/Slider/Slider.stories.tsx +88 -0
- package/src/components/Slider/Slider.tsx +139 -0
- package/src/components/Slider/Slider.types.ts +21 -0
- package/src/components/Submenus/AdminSubmenu.tsx +17 -0
- package/src/components/Submenus/AlertSubmenu.tsx +56 -0
- package/src/components/Submenus/AlertSubmenuItem.tsx +39 -0
- package/src/components/Submenus/types.tsx +32 -0
- package/src/components/Toaster/Toaster.stories.tsx +4 -6
- package/src/components/Toaster/Toaster.test.tsx +3 -4
- package/src/components/Toaster/Toaster.tsx +9 -17
- package/src/components/Toaster/Toaster.types.ts +2 -2
- package/src/utils/assertTagName.tsx +1 -1
- package/src/utils/generateAccordionItem.tsx +7 -13
- package/src/utils/generateFooterContacts.tsx +4 -9
- package/src/utils/getFontAwesomeIcon.tsx +8 -13
- package/tailwind.config.js +11 -3
- package/src/components/Badge/badgeClassNames.tsx +0 -173
- package/src/components/Card/cardClassNames.ts +0 -49
- package/src/components/Footer/footerClassNames.tsx +0 -57
- package/src/components/FormButton/formButtonClassNames.tsx +0 -153
- package/src/components/GenericList/genericListClassNames.tsx +0 -8
- package/src/components/Header/headerClassNames.tsx +0 -50
- package/src/components/Icon/Icon.stories.tsx +0 -227
- package/src/components/Icon/Icon.tsx +0 -208
- package/src/components/Icon/Icon.types.ts +0 -24
- package/src/components/Icon/iconClassNames.ts +0 -79
- package/src/components/Icon/index.ts +0 -2
- package/src/components/Input/inputClassNames.tsx +0 -169
- package/src/components/Nav/navClassNames.tsx +0 -192
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import FormButton from "../../FormButton/FormButton";
|
|
2
3
|
import Text from "../../Text/Text";
|
|
3
4
|
import Image from "../../Image/Image";
|
|
5
|
+
import Badge from "../../Badge/Badge";
|
|
4
6
|
import { TagName } from "../../Text/Text.types";
|
|
5
|
-
import { getFontAwesomeIcon } from "../../../utils/getFontAwesomeIcon";
|
|
6
7
|
|
|
7
8
|
type DataTypes = {
|
|
8
9
|
id: string;
|
|
@@ -46,108 +47,122 @@ type DataTypes = {
|
|
|
46
47
|
borderColor: string;
|
|
47
48
|
shape: string;
|
|
48
49
|
color: string;
|
|
49
|
-
hoverBackground
|
|
50
|
+
hoverBackground?: string;
|
|
50
51
|
additionalClasses: string;
|
|
51
52
|
};
|
|
53
|
+
badgeText: string;
|
|
54
|
+
description: string;
|
|
52
55
|
};
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
type VerticalCardTemplateProps = {
|
|
58
|
+
data: DataTypes;
|
|
59
|
+
containerClasses?: string;
|
|
60
|
+
imageContainerClasses?: string;
|
|
61
|
+
titleContainerClasses?: string;
|
|
62
|
+
descriptionContainerClasses?: string;
|
|
63
|
+
priceContainerClasses?: string;
|
|
64
|
+
buttonContainerClasses?: string;
|
|
65
|
+
badgeContainerClasses?: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const VerticalCardTemplate = ({
|
|
69
|
+
data,
|
|
70
|
+
containerClasses = "",
|
|
71
|
+
imageContainerClasses = "",
|
|
72
|
+
titleContainerClasses = "",
|
|
73
|
+
descriptionContainerClasses = "",
|
|
74
|
+
priceContainerClasses = "",
|
|
75
|
+
buttonContainerClasses = "",
|
|
76
|
+
badgeContainerClasses = "",
|
|
77
|
+
}: VerticalCardTemplateProps) => {
|
|
55
78
|
return (
|
|
56
|
-
|
|
57
|
-
<
|
|
79
|
+
<div className={`${containerClasses} p-4`}>
|
|
80
|
+
<div className={badgeContainerClasses}>
|
|
81
|
+
<Badge
|
|
82
|
+
text={
|
|
83
|
+
<Text
|
|
84
|
+
color=""
|
|
85
|
+
fontFamily="font-serif"
|
|
86
|
+
tag="p"
|
|
87
|
+
text={data.badgeText}
|
|
88
|
+
size="text-md"
|
|
89
|
+
/>
|
|
90
|
+
}
|
|
91
|
+
type="span"
|
|
92
|
+
hoverColor=""
|
|
93
|
+
additionalClasses="flex items-center justify-center gap-1 px-3 py-2 rounded-md border-none"
|
|
94
|
+
badgeContainerClasses="text-slate-800"
|
|
95
|
+
backgroundColor="bg-slate-100"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<div className={`relative ${imageContainerClasses}`}>
|
|
58
99
|
<Image
|
|
59
100
|
background={false}
|
|
60
101
|
src={data.imageUrl}
|
|
61
102
|
alt={data.altText}
|
|
103
|
+
additionalClasses="w-full h-full object-contain"
|
|
62
104
|
/>
|
|
63
|
-
</
|
|
64
|
-
<div className=
|
|
65
|
-
<div className="flex
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
data.titleProps.additionalClasses
|
|
75
|
-
}
|
|
76
|
-
/>
|
|
77
|
-
</a>
|
|
105
|
+
</div>
|
|
106
|
+
<div className={titleContainerClasses}>
|
|
107
|
+
<div className="flex flex-col">
|
|
108
|
+
<Text
|
|
109
|
+
tag={data.titleProps.tag as TagName}
|
|
110
|
+
size={data.titleProps.size}
|
|
111
|
+
text={data.title}
|
|
112
|
+
color={data.titleProps.fontColor}
|
|
113
|
+
fontFamily={data.titleProps.fontFamily}
|
|
114
|
+
additionalClasses={data.titleProps.additionalClasses}
|
|
115
|
+
/>
|
|
78
116
|
</div>
|
|
79
|
-
<div
|
|
80
|
-
className=
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
: getFontAwesomeIcon(
|
|
90
|
-
data.inStockProps.outOfStockIcon
|
|
91
|
-
)}
|
|
117
|
+
<div className={descriptionContainerClasses}>
|
|
118
|
+
<div className="relative flex items-center gap-2">
|
|
119
|
+
<div className="w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden z-10">
|
|
120
|
+
<Image
|
|
121
|
+
background={false}
|
|
122
|
+
src="../../../assets/compass-card-image-4.png"
|
|
123
|
+
alt="Icon 1"
|
|
124
|
+
additionalClasses="object-cover w-full h-full"
|
|
125
|
+
/>
|
|
92
126
|
</div>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
: "Out of Stock"
|
|
100
|
-
}
|
|
101
|
-
color={"black"}
|
|
102
|
-
fontFamily={""}
|
|
103
|
-
additionalClasses={
|
|
104
|
-
data.inStockProps.additionalClasses
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
</div>
|
|
108
|
-
<div className="flex px-2 items-center space-x-1 rtl:space-x-reverse ">
|
|
109
|
-
<svg
|
|
110
|
-
className="w-4 h-4 text-yellow-300"
|
|
111
|
-
aria-hidden="true"
|
|
112
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
-
fill="currentColor"
|
|
114
|
-
viewBox="0 0 22 20"
|
|
115
|
-
>
|
|
116
|
-
<path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z" />
|
|
117
|
-
</svg>
|
|
118
|
-
<span className="bg-white text-blue-800 text-xs font-semibold px-2.5 py-0.5 rounded dark:bg-blue-200 dark:text-blue-800 ms-3">
|
|
119
|
-
{data.rating}
|
|
120
|
-
</span>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
<div className={`flex w-full`}>
|
|
124
|
-
<div className="flex items-end flex-col w-full">
|
|
125
|
-
<div className="px-2 mb-2">
|
|
126
|
-
<Text
|
|
127
|
-
tag={data.priceProps.tag as TagName}
|
|
128
|
-
size={data.priceProps.size}
|
|
129
|
-
text={data.price}
|
|
130
|
-
color={"black"}
|
|
131
|
-
fontFamily={""}
|
|
132
|
-
additionalClasses={
|
|
133
|
-
data.priceProps.additionalClasses
|
|
134
|
-
}
|
|
127
|
+
<div className="w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden -ml-[20px]">
|
|
128
|
+
<Image
|
|
129
|
+
background={false}
|
|
130
|
+
src="../../../assets/compass-card-image-2.png"
|
|
131
|
+
alt="Icon 2"
|
|
132
|
+
additionalClasses="object-cover w-full h-full"
|
|
135
133
|
/>
|
|
136
134
|
</div>
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
hoverBackground={data.buttonProps.hoverBackground}
|
|
145
|
-
additionalClasses="w-24"
|
|
135
|
+
<Text
|
|
136
|
+
tag="span"
|
|
137
|
+
size="text-sm"
|
|
138
|
+
text={data.description}
|
|
139
|
+
color="text-gray-500"
|
|
140
|
+
fontFamily="font-sans"
|
|
141
|
+
additionalClasses="ml-4"
|
|
146
142
|
/>
|
|
147
143
|
</div>
|
|
148
144
|
</div>
|
|
145
|
+
<div className={priceContainerClasses}>
|
|
146
|
+
<Text
|
|
147
|
+
tag={data.priceProps.tag as TagName}
|
|
148
|
+
size={data.priceProps.size}
|
|
149
|
+
text={data.price}
|
|
150
|
+
color={data.priceProps.fontColor}
|
|
151
|
+
fontFamily={data.priceProps.fontFamily}
|
|
152
|
+
additionalClasses={data.priceProps.additionalClasses}
|
|
153
|
+
/>
|
|
154
|
+
<FormButton
|
|
155
|
+
text={data.buttonProps.text}
|
|
156
|
+
backgroundColor={data.buttonProps.color}
|
|
157
|
+
fontColor={data.buttonProps.fontColor}
|
|
158
|
+
size={data.buttonProps.size}
|
|
159
|
+
shape={data.buttonProps.shape}
|
|
160
|
+
borderColor={data.buttonProps.borderColor}
|
|
161
|
+
additionalClasses={buttonContainerClasses}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
149
164
|
</div>
|
|
150
|
-
|
|
165
|
+
</div>
|
|
151
166
|
);
|
|
152
167
|
};
|
|
153
168
|
|
|
@@ -46,7 +46,7 @@ const CounterButton: React.FC<CounterButtonTypes> = ({
|
|
|
46
46
|
onClick={onDecrementClick}
|
|
47
47
|
/>
|
|
48
48
|
<div
|
|
49
|
-
className={`
|
|
49
|
+
className={`flex justify-center items-center border-x border-gray-300`}
|
|
50
50
|
>
|
|
51
51
|
<input
|
|
52
52
|
type="text"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
import Description from './Description';
|
|
4
|
+
import { DescriptionProps } from './Description.types';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Description',
|
|
8
|
+
component: Description,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
containerClassName: {
|
|
15
|
+
control: 'none',
|
|
16
|
+
description: 'Styles for the container.',
|
|
17
|
+
},
|
|
18
|
+
titleClassName: {
|
|
19
|
+
control: 'none',
|
|
20
|
+
description: 'Styles for the title.',
|
|
21
|
+
},
|
|
22
|
+
contentClassName: {
|
|
23
|
+
control: 'none',
|
|
24
|
+
description: 'Styles for the content.',
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
control: 'none',
|
|
28
|
+
description: 'Title of the description.',
|
|
29
|
+
},
|
|
30
|
+
children: {
|
|
31
|
+
control: 'none',
|
|
32
|
+
description: 'Content of the description.',
|
|
33
|
+
},
|
|
34
|
+
style: {
|
|
35
|
+
control: 'none',
|
|
36
|
+
description: 'Styles for the description.',
|
|
37
|
+
table: { disable: true }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
} as Meta;
|
|
41
|
+
|
|
42
|
+
const Template: StoryFn<DescriptionProps> = (args) => <Description {...args} />;
|
|
43
|
+
|
|
44
|
+
export const Default = Template.bind({});
|
|
45
|
+
Default.args = {
|
|
46
|
+
title: 'Sample Title',
|
|
47
|
+
children: <span>This is a sample description content.</span>,
|
|
48
|
+
containerClassName: 'p-4 sm:p-6 md:p-8 lg:p-10',
|
|
49
|
+
titleClassName: 'text-xl sm:text-2xl md:text-3xl lg:text-4xl font-bold mb-4',
|
|
50
|
+
contentClassName: 'text-base sm:text-lg md:text-xl lg:text-2xl',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const WithCustomStyles = Template.bind({});
|
|
54
|
+
WithCustomStyles.args = {
|
|
55
|
+
title: 'Styled Title',
|
|
56
|
+
children: (
|
|
57
|
+
<span>
|
|
58
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
59
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
|
|
60
|
+
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
|
61
|
+
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
62
|
+
</span>
|
|
63
|
+
),
|
|
64
|
+
containerClassName: 'p-4 sm:p-6 md:p-8 lg:p-10 bg-gray-100',
|
|
65
|
+
titleClassName: 'text-xl sm:text-2xl md:text-3xl lg:text-4xl font-bold mb-4 text-blue-500',
|
|
66
|
+
contentClassName: 'text-base sm:text-lg md:text-xl lg:text-2xl text-blue-500',
|
|
67
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DescriptionProps } from './Description.types';
|
|
3
|
+
|
|
4
|
+
const Description: React.FC<DescriptionProps> = ({ title, children, containerClassName, titleClassName, contentClassName }) => {
|
|
5
|
+
return (
|
|
6
|
+
<div className={`${containerClassName}`}>
|
|
7
|
+
<div className={`${titleClassName}`}>{title}</div>
|
|
8
|
+
<div className={`${contentClassName}`}>{children}</div>
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default Description;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
|
+
import DropDownIconButton from "./DropDownIconButton";
|
|
4
|
+
import { DropDownIconButtonProps } from "./DropDownIconButton.types";
|
|
5
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
6
|
+
import AlertSubmenu from "../Submenus/AlertSubmenu";
|
|
7
|
+
import AdminSubmenu from "../Submenus/AdminSubmenu";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Components/DropDownIconButton",
|
|
11
|
+
component: DropDownIconButton,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
iconSize: {
|
|
15
|
+
control: 'none',
|
|
16
|
+
description: "Tailwind classes for the icon size. Example: `h-6 w-6`",
|
|
17
|
+
},
|
|
18
|
+
iconColor: {
|
|
19
|
+
control: 'none',
|
|
20
|
+
description: "Tailwind classes for the icon color. Example: `text-blue-500`",
|
|
21
|
+
},
|
|
22
|
+
backgroundColor: {
|
|
23
|
+
control: 'none',
|
|
24
|
+
description: "Tailwind classes for the background color. Example: `bg-gray-200`",
|
|
25
|
+
},
|
|
26
|
+
borderColor: {
|
|
27
|
+
control: 'none',
|
|
28
|
+
description: "Tailwind classes for the border color. Example: `border-gray-300`",
|
|
29
|
+
},
|
|
30
|
+
hoverBorderColor: {
|
|
31
|
+
control: 'none',
|
|
32
|
+
description: "Tailwind classes for the border color on hover. Example: `hover:border-blue-500`",
|
|
33
|
+
},
|
|
34
|
+
hoverBackgroundColor: {
|
|
35
|
+
control: 'none',
|
|
36
|
+
description: "Tailwind classes for the background on hover. Example: `hover:bg-gray-300`",
|
|
37
|
+
},
|
|
38
|
+
hasNotification: {
|
|
39
|
+
control: 'none',
|
|
40
|
+
description: "Flag to indicate if the button has a notification badge.",
|
|
41
|
+
},
|
|
42
|
+
notificationTextColor: {
|
|
43
|
+
control: 'none',
|
|
44
|
+
description: "Tailwind classes for the notification text color. Example: `text-white`",
|
|
45
|
+
},
|
|
46
|
+
notificationBgColor: {
|
|
47
|
+
control: 'none',
|
|
48
|
+
description: "Tailwind classes for the notification background color. Example: `bg-red-500`",
|
|
49
|
+
},
|
|
50
|
+
notificationCount: {
|
|
51
|
+
control: 'none',
|
|
52
|
+
description: "The number to be displayed inside the notification badge. Example: `12`",
|
|
53
|
+
},
|
|
54
|
+
text: {
|
|
55
|
+
control: 'none',
|
|
56
|
+
description: "The text to be displayed below the button. Example: `Profile`",
|
|
57
|
+
},
|
|
58
|
+
textClasses: {
|
|
59
|
+
control: 'none',
|
|
60
|
+
description: "Tailwind classes to style the text. Example: `text-sm text-black`",
|
|
61
|
+
},
|
|
62
|
+
menuPlacementClasses: {
|
|
63
|
+
control: 'none',
|
|
64
|
+
description: "Tailwind classes to position the dropdown menu. Example: `right-0 top-full mt-5 w-[200px]`",
|
|
65
|
+
},
|
|
66
|
+
submenu: {
|
|
67
|
+
control: 'none',
|
|
68
|
+
description: "React node representing the submenu to be displayed in the dropdown.",
|
|
69
|
+
},
|
|
70
|
+
onClick: {
|
|
71
|
+
table: {
|
|
72
|
+
disable: true,
|
|
73
|
+
},
|
|
74
|
+
control: 'none',
|
|
75
|
+
description: "Callback function to handle click events.",
|
|
76
|
+
},
|
|
77
|
+
icon: {
|
|
78
|
+
control: 'none',
|
|
79
|
+
description: "React node representing the icon to be displayed in the button.",
|
|
80
|
+
},
|
|
81
|
+
textContainerClasses: {
|
|
82
|
+
control: 'none',
|
|
83
|
+
description: "Tailwind classes to style the container of the text. Example: `text-center`",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
parameters: {
|
|
87
|
+
layout: "centered",
|
|
88
|
+
},
|
|
89
|
+
} as Meta;
|
|
90
|
+
|
|
91
|
+
const Template: StoryFn<DropDownIconButtonProps> = (args) => <DropDownIconButton {...args} />;
|
|
92
|
+
|
|
93
|
+
export const Default = Template.bind({});
|
|
94
|
+
Default.args = {
|
|
95
|
+
icon: getFontAwesomeIcon("cog"),
|
|
96
|
+
iconSize: "h-8 w-8",
|
|
97
|
+
iconColor: "text-black",
|
|
98
|
+
hasNotification: true,
|
|
99
|
+
notificationTextColor: "text-white",
|
|
100
|
+
notificationBgColor: "bg-green-600",
|
|
101
|
+
notificationCount: 5,
|
|
102
|
+
text: "Settings",
|
|
103
|
+
textClasses: "text-black font-serif text-md",
|
|
104
|
+
hoverBackgroundColor: "hover:bg-gray-300",
|
|
105
|
+
backgroundColor: "bg-gray-200",
|
|
106
|
+
borderColor: "border-gray-300",
|
|
107
|
+
hoverBorderColor: "hover:border-black",
|
|
108
|
+
menuPlacementClasses: "right-0 top-full mt-2 w-[200px]",
|
|
109
|
+
submenu: (
|
|
110
|
+
<AdminSubmenu
|
|
111
|
+
menuClasses="p-4 bg-white rounded-lg shadow-lg"
|
|
112
|
+
callToActionChildren={
|
|
113
|
+
<div className="text-gray-800 font-medium">Manage Settings</div>
|
|
114
|
+
}
|
|
115
|
+
secondCallToActionChildren={
|
|
116
|
+
<div className="text-gray-600">More settings options...</div>
|
|
117
|
+
}
|
|
118
|
+
/>
|
|
119
|
+
),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const Alerts = Template.bind({});
|
|
123
|
+
Alerts.args = {
|
|
124
|
+
icon: getFontAwesomeIcon("bell"),
|
|
125
|
+
iconSize: "h-8 w-8",
|
|
126
|
+
iconColor: "text-black",
|
|
127
|
+
hasNotification: true,
|
|
128
|
+
notificationTextColor: "text-white",
|
|
129
|
+
notificationBgColor: "bg-red-600",
|
|
130
|
+
notificationCount: 3,
|
|
131
|
+
text: "Alerts",
|
|
132
|
+
textClasses: "text-black font-serif text-md",
|
|
133
|
+
hoverBackgroundColor: "hover:bg-gray-300",
|
|
134
|
+
backgroundColor: "bg-gray-200",
|
|
135
|
+
borderColor: "border-gray-300",
|
|
136
|
+
hoverBorderColor: "hover:border-black",
|
|
137
|
+
menuPlacementClasses: "right-0 top-full mt-2 w-[344px]",
|
|
138
|
+
submenu: (
|
|
139
|
+
<AlertSubmenu
|
|
140
|
+
data={[
|
|
141
|
+
{ title: "Order SA100000 status updated to Fulfilled", subtitle: "14h ago", link: "#" },
|
|
142
|
+
{ title: "You have a new request from Gina Prince", subtitle: "Open TOGa Supply", link: "#" },
|
|
143
|
+
{ title: "Order SA100002 status updated to Fulfilled", subtitle: "2d ago", link: "#" },
|
|
144
|
+
]}
|
|
145
|
+
newAlertCount={4}
|
|
146
|
+
newAlertColor="bg-light-green-800"
|
|
147
|
+
clearAlertsText="Mark all as Read"
|
|
148
|
+
clearAlertsTextClasses="text-gray-3 hover:text-dark-green-800"
|
|
149
|
+
newAlertCountClasses="text-gray-900 font-semibold"
|
|
150
|
+
menuContainerClasses="overflow-hidden rounded-lg border-1 border-stroke bg-white shadow-lg"
|
|
151
|
+
menuHeaderContainerClasses="flex justify-between items-center p-4 border-b border-gray-200"
|
|
152
|
+
alertListContainerClasses="overflow-y-auto max-h-[300px] divide-y divide-gray-200"
|
|
153
|
+
/>
|
|
154
|
+
),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const Admin = Template.bind({});
|
|
158
|
+
Admin.args = {
|
|
159
|
+
icon: getFontAwesomeIcon("user"),
|
|
160
|
+
iconSize: "h-8 w-8",
|
|
161
|
+
iconColor: "text-black",
|
|
162
|
+
hasNotification: false,
|
|
163
|
+
notificationTextColor: "text-white",
|
|
164
|
+
notificationBgColor: "bg-blue-600",
|
|
165
|
+
notificationCount: 0,
|
|
166
|
+
text: "Admin",
|
|
167
|
+
textClasses: "text-black font-serif text-md",
|
|
168
|
+
hoverBackgroundColor: "hover:bg-gray-300",
|
|
169
|
+
backgroundColor: "bg-gray-200",
|
|
170
|
+
borderColor: "border-gray-300",
|
|
171
|
+
hoverBorderColor: "hover:border-black",
|
|
172
|
+
menuPlacementClasses: "right-0 top-full mt-2 w-[344px]",
|
|
173
|
+
submenu: (
|
|
174
|
+
<AdminSubmenu
|
|
175
|
+
menuClasses="overflow-hidden rounded-lg border-1 border-stroke bg-white shadow-lg p-6"
|
|
176
|
+
callToActionChildren={
|
|
177
|
+
<div className="flex items-center text-gray-700">
|
|
178
|
+
<a href="#" className="hover:text-dark-green-800">
|
|
179
|
+
<span className="pr-2">{getFontAwesomeIcon("inbox", "regular")}</span>
|
|
180
|
+
Manage Requests
|
|
181
|
+
</a>
|
|
182
|
+
</div>
|
|
183
|
+
}
|
|
184
|
+
secondCallToActionChildren={
|
|
185
|
+
<div className="flex flex-col text-gray-700">
|
|
186
|
+
<p className="pb-3">
|
|
187
|
+
<span className="pr-2">{getFontAwesomeIcon("glasses", "regular")}</span>
|
|
188
|
+
View As
|
|
189
|
+
</p>
|
|
190
|
+
<div className="border rounded-md border-stroke p-4">
|
|
191
|
+
Placeholder Input - Behavior TBD
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
}
|
|
195
|
+
/>
|
|
196
|
+
),
|
|
197
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen, fireEvent } from "@testing-library/react";
|
|
3
|
+
import DropDownIconButton from "./DropDownIconButton";
|
|
4
|
+
import { AlertSubmenuProps } from "./types";
|
|
5
|
+
|
|
6
|
+
const alertData = [
|
|
7
|
+
{
|
|
8
|
+
link: "#",
|
|
9
|
+
title: "New Comment",
|
|
10
|
+
subtitle: "You have a new comment on your post.",
|
|
11
|
+
status: true,
|
|
12
|
+
externalLink: "View Comment",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
link: "#",
|
|
16
|
+
title: "New Like",
|
|
17
|
+
subtitle: "Someone liked your post.",
|
|
18
|
+
status: true,
|
|
19
|
+
externalLink: "View Post",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const AlertSubmenu = ({ data }: AlertSubmenuProps) => (
|
|
24
|
+
<div data-testid="alert-submenu">
|
|
25
|
+
{data.map((alert, index) => (
|
|
26
|
+
<div key={index}>
|
|
27
|
+
<h6>{alert.title}</h6>
|
|
28
|
+
<p>{alert.subtitle}</p>
|
|
29
|
+
</div>
|
|
30
|
+
))}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
describe("DropDownIconButton", () => {
|
|
35
|
+
test("renders correctly with AlertSubmenu", () => {
|
|
36
|
+
render(
|
|
37
|
+
<DropDownIconButton
|
|
38
|
+
icon={<img src="/path/to/icon.png" alt="icon" />}
|
|
39
|
+
iconSize="text-sm"
|
|
40
|
+
iconColor="text-black"
|
|
41
|
+
hasNotification={true}
|
|
42
|
+
notificationTextColor="text-white"
|
|
43
|
+
notificationBgColor="bg-dark-green-800"
|
|
44
|
+
notificationCount={4}
|
|
45
|
+
text="Notifications"
|
|
46
|
+
textClasses="text-sm pt-1 font-medium text-black"
|
|
47
|
+
hoverBackgroundColor="group-hover:bg-dark-green-200"
|
|
48
|
+
backgroundColor="bg-gray-2"
|
|
49
|
+
menuPlacementClasses="right-0 top-full mt-5 w-[344px]"
|
|
50
|
+
submenu={<AlertSubmenu data={alertData} />}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const button = screen.getByLabelText(/Notifications/);
|
|
55
|
+
fireEvent.click(button);
|
|
56
|
+
|
|
57
|
+
expect(screen.getByTestId("alert-submenu")).toBeInTheDocument();
|
|
58
|
+
expect(screen.getByText(/New Comment/)).toBeInTheDocument();
|
|
59
|
+
expect(screen.getByText(/New Like/)).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("toggles menu visibility on button click", () => {
|
|
63
|
+
render(
|
|
64
|
+
<DropDownIconButton
|
|
65
|
+
icon={<img src="/path/to/icon.png" alt="icon" />}
|
|
66
|
+
iconSize="text-sm"
|
|
67
|
+
iconColor="text-black"
|
|
68
|
+
hasNotification={true}
|
|
69
|
+
notificationTextColor="text-white"
|
|
70
|
+
notificationBgColor="bg-dark-green-800"
|
|
71
|
+
notificationCount={4}
|
|
72
|
+
text="Notifications"
|
|
73
|
+
textClasses="text-sm pt-1 font-medium text-black"
|
|
74
|
+
hoverBackgroundColor="group-hover:bg-dark-green-200"
|
|
75
|
+
backgroundColor="bg-gray-2"
|
|
76
|
+
menuPlacementClasses="right-0 top-full mt-5 w-[344px]"
|
|
77
|
+
submenu={<AlertSubmenu data={alertData} />}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const button = screen.getByLabelText(/Notifications/);
|
|
82
|
+
fireEvent.click(button);
|
|
83
|
+
|
|
84
|
+
const submenu = screen.getByTestId("alert-submenu");
|
|
85
|
+
expect(submenu).toBeVisible();
|
|
86
|
+
|
|
87
|
+
fireEvent.click(button);
|
|
88
|
+
expect(submenu).not.toBeVisible();
|
|
89
|
+
});
|
|
90
|
+
});
|