@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { DropDownIconButtonProps } from "./DropDownIconButton.types";
|
|
3
|
+
import IconButton from "../IconButton/IconButton";
|
|
4
|
+
|
|
5
|
+
const DropDownIconButton: React.FC<DropDownIconButtonProps> = ({
|
|
6
|
+
icon,
|
|
7
|
+
iconSize,
|
|
8
|
+
iconColor,
|
|
9
|
+
hasNotification,
|
|
10
|
+
notificationTextColor,
|
|
11
|
+
notificationBgColor,
|
|
12
|
+
notificationCount,
|
|
13
|
+
text,
|
|
14
|
+
textContainerClasses,
|
|
15
|
+
hoverBorderColor,
|
|
16
|
+
hoverBackgroundColor,
|
|
17
|
+
backgroundColor,
|
|
18
|
+
borderColor,
|
|
19
|
+
textClasses,
|
|
20
|
+
submenu,
|
|
21
|
+
menuPlacementClasses,
|
|
22
|
+
onClick,
|
|
23
|
+
}) => {
|
|
24
|
+
const [open, setOpen] = useState(false);
|
|
25
|
+
|
|
26
|
+
const menuTrigger = useRef<HTMLDivElement>(null);
|
|
27
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
28
|
+
|
|
29
|
+
const useClickOutside = (
|
|
30
|
+
refs: React.RefObject<HTMLElement>[],
|
|
31
|
+
isOpen: boolean,
|
|
32
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>
|
|
33
|
+
) => {
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const clickHandler = ({ target }: MouseEvent) => {
|
|
36
|
+
if (
|
|
37
|
+
!refs.some((ref) => ref.current) ||
|
|
38
|
+
!isOpen ||
|
|
39
|
+
refs.some((ref) => ref.current?.contains(target as Node))
|
|
40
|
+
)
|
|
41
|
+
return;
|
|
42
|
+
setIsOpen(false);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
document.addEventListener("click", clickHandler);
|
|
46
|
+
return () => document.removeEventListener("click", clickHandler);
|
|
47
|
+
}, [refs, isOpen, setIsOpen]);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
useClickOutside([menuRef, menuTrigger], open, setOpen);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className="relative z-20">
|
|
54
|
+
<div
|
|
55
|
+
ref={menuTrigger}
|
|
56
|
+
onClick={() => setOpen(!open)}
|
|
57
|
+
className="flex flex-col items-center justify-center group"
|
|
58
|
+
>
|
|
59
|
+
<IconButton
|
|
60
|
+
icon={icon}
|
|
61
|
+
iconSize={iconSize}
|
|
62
|
+
iconColor={iconColor}
|
|
63
|
+
hasNotification={hasNotification}
|
|
64
|
+
notificationTextClasses={notificationTextColor}
|
|
65
|
+
notificationBgColor={notificationBgColor}
|
|
66
|
+
notificationCount={notificationCount}
|
|
67
|
+
text={text}
|
|
68
|
+
textClasses={textClasses}
|
|
69
|
+
hoverBorderColor={hoverBorderColor}
|
|
70
|
+
hoverBackgroundColor={hoverBackgroundColor}
|
|
71
|
+
backgroundColor={backgroundColor}
|
|
72
|
+
borderColor={borderColor}
|
|
73
|
+
additionalContainerClasses={textContainerClasses}
|
|
74
|
+
onClick={onClick}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
ref={menuRef}
|
|
79
|
+
className={`absolute ${menuPlacementClasses} ${!open ? "hidden" : ""}`}
|
|
80
|
+
>
|
|
81
|
+
{submenu}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default DropDownIconButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface DropDownIconButtonProps {
|
|
4
|
+
icon: React.ReactNode;
|
|
5
|
+
iconSize: string;
|
|
6
|
+
iconColor: string;
|
|
7
|
+
hasNotification: boolean;
|
|
8
|
+
notificationTextColor: string;
|
|
9
|
+
notificationBgColor: string;
|
|
10
|
+
notificationCount: number;
|
|
11
|
+
text: string;
|
|
12
|
+
textContainerClasses?: string;
|
|
13
|
+
hoverBorderColor?: string;
|
|
14
|
+
hoverBackgroundColor?: string;
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
borderColor?: string;
|
|
17
|
+
textClasses?: string;
|
|
18
|
+
submenu: React.ReactNode;
|
|
19
|
+
menuPlacementClasses: string;
|
|
20
|
+
onClick?: () => void;
|
|
21
|
+
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
2
|
|
|
5
3
|
interface ContactInfoItemProps {
|
|
6
|
-
icon:
|
|
4
|
+
icon: JSX.Element | null;
|
|
7
5
|
children: ReactNode;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
export const ContactInfoItem: React.FC<ContactInfoItemProps> = ({
|
|
11
9
|
icon,
|
|
12
10
|
children,
|
|
13
|
-
}) =>
|
|
14
|
-
|
|
15
|
-
<div className="flex w-
|
|
16
|
-
<
|
|
11
|
+
}) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="flex w-full space-between pb-3">
|
|
14
|
+
<div className="flex w-[10%] my-1">{icon}</div>
|
|
15
|
+
<div className="my-1">{children}</div>
|
|
17
16
|
</div>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Meta, StoryFn } from "@storybook/react";
|
|
3
2
|
import Footer from "./Footer";
|
|
4
3
|
import { FooterProps } from "./Footer.types";
|
|
@@ -12,8 +11,9 @@ const StoryBookViewFooter = withStoryBook(Footer);
|
|
|
12
11
|
|
|
13
12
|
export default {
|
|
14
13
|
title: "Footers/Footer",
|
|
14
|
+
component: StoryBookViewFooter,
|
|
15
|
+
|
|
15
16
|
argTypes: {
|
|
16
|
-
// LOGO & BACKGROUND & FOOTER BAR
|
|
17
17
|
logo: {
|
|
18
18
|
control: "none",
|
|
19
19
|
description: "The logo displayed in the footer",
|
|
@@ -31,8 +31,6 @@ export default {
|
|
|
31
31
|
control: "color",
|
|
32
32
|
description: "Whether the footer has a background color.",
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
// TITLE AND SLOGAN
|
|
36
34
|
title: {
|
|
37
35
|
control: "text",
|
|
38
36
|
description: "The title displayed in the footer",
|
|
@@ -49,8 +47,6 @@ export default {
|
|
|
49
47
|
control: "boolean",
|
|
50
48
|
description: "Whether the footer has a slogan displayed",
|
|
51
49
|
},
|
|
52
|
-
|
|
53
|
-
// NAV
|
|
54
50
|
hasNavItems: {
|
|
55
51
|
control: "boolean",
|
|
56
52
|
description: "Whether the footer has navigation items.",
|
|
@@ -70,8 +66,6 @@ export default {
|
|
|
70
66
|
disable: true,
|
|
71
67
|
},
|
|
72
68
|
},
|
|
73
|
-
|
|
74
|
-
// SOCIAL
|
|
75
69
|
socialTitle: {
|
|
76
70
|
table: {
|
|
77
71
|
disable: true,
|
|
@@ -86,15 +80,11 @@ export default {
|
|
|
86
80
|
control: "boolean",
|
|
87
81
|
description: "Whether the footer has social icons displayed",
|
|
88
82
|
},
|
|
89
|
-
|
|
90
|
-
// CONTACT
|
|
91
83
|
contactTitle: {
|
|
92
84
|
table: {
|
|
93
85
|
disable: true,
|
|
94
86
|
},
|
|
95
87
|
},
|
|
96
|
-
|
|
97
|
-
// COPYRIGHT
|
|
98
88
|
copyRightTextPlacement: {
|
|
99
89
|
control: "select",
|
|
100
90
|
options: ["left", "center", "right"],
|
|
@@ -108,10 +98,12 @@ export default {
|
|
|
108
98
|
},
|
|
109
99
|
hasCopyRight: {
|
|
110
100
|
control: "boolean",
|
|
111
|
-
description:
|
|
112
|
-
"Whether the footer has a copyright statement displayed",
|
|
101
|
+
description: "Whether the footer has a copyright statement displayed",
|
|
113
102
|
},
|
|
114
103
|
},
|
|
104
|
+
parameters: {
|
|
105
|
+
tags: ["autodocs"],
|
|
106
|
+
},
|
|
115
107
|
} as Meta<FooterProps>;
|
|
116
108
|
|
|
117
109
|
const Template: StoryFn<typeof StoryBookViewFooter> = (args) => (
|
|
@@ -149,7 +141,7 @@ Default.args = {
|
|
|
149
141
|
/>
|
|
150
142
|
),
|
|
151
143
|
copyRightTextPlacement: "center",
|
|
152
|
-
socialPlacement: "center",
|
|
144
|
+
socialPlacement: "flex justify-center mt-4",
|
|
153
145
|
};
|
|
154
146
|
|
|
155
147
|
export const CompassFooter = Template.bind({});
|
|
@@ -159,7 +151,7 @@ CompassFooter.args = {
|
|
|
159
151
|
src="../../../assets/compass-logo.png"
|
|
160
152
|
alt="Generic Compass Logo."
|
|
161
153
|
background={false}
|
|
162
|
-
additionalClasses="
|
|
154
|
+
additionalClasses="w-40 p-2"
|
|
163
155
|
/>
|
|
164
156
|
),
|
|
165
157
|
title: (
|
|
@@ -214,9 +206,9 @@ CompassFooter.args = {
|
|
|
214
206
|
hasSocial: true,
|
|
215
207
|
logoHoverColor: "green",
|
|
216
208
|
backgroundColor: "green",
|
|
217
|
-
accordionGap: "gap-
|
|
209
|
+
accordionGap: "gap-2",
|
|
218
210
|
copyRightTextPlacement: "center",
|
|
219
|
-
socialPlacement: "center",
|
|
211
|
+
socialPlacement: "flex justify-center mt-4",
|
|
220
212
|
accordionParentStyle: "border-b border-black p-2 w-full",
|
|
221
213
|
accordionExpandedStyle: "pl-3 py-3",
|
|
222
214
|
};
|
|
@@ -228,7 +220,7 @@ AlternateMobileNavStyle.args = {
|
|
|
228
220
|
src="../../../assets/compass-logo.png"
|
|
229
221
|
alt="Generic Compass Logo."
|
|
230
222
|
background={false}
|
|
231
|
-
additionalClasses="
|
|
223
|
+
additionalClasses="w-40 p-2"
|
|
232
224
|
/>
|
|
233
225
|
),
|
|
234
226
|
title: (
|
|
@@ -285,8 +277,7 @@ AlternateMobileNavStyle.args = {
|
|
|
285
277
|
logoHoverColor: "green",
|
|
286
278
|
backgroundColor: "green",
|
|
287
279
|
copyRightTextPlacement: "center",
|
|
288
|
-
socialPlacement: "center",
|
|
289
|
-
accordionParentStyle:
|
|
290
|
-
"rounded-md border-black p-2 w-full bg-teal-700 text-white",
|
|
280
|
+
socialPlacement: "flex justify-center mt-4",
|
|
281
|
+
accordionParentStyle: "rounded-md border-black p-2 w-full bg-teal-700 text-white",
|
|
291
282
|
accordionExpandedStyle: "pl-2 py-3",
|
|
292
283
|
};
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Image from "../Image/Image";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
DUMMYCONTACTDATA,
|
|
6
|
-
DUMMYNAVDATA,
|
|
7
|
-
DUMMYSOCIALDATA,
|
|
8
|
-
} from "./DUMMYFOOTERDATA.json";
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
getLogoClasses,
|
|
12
|
-
getBackgroundColor,
|
|
13
|
-
getSocialPlacement,
|
|
14
|
-
getCopyRightPlacement,
|
|
15
|
-
} from "./footerClassNames";
|
|
16
|
-
|
|
3
|
+
import { DUMMYCONTACTDATA, DUMMYNAVDATA, DUMMYSOCIALDATA } from "./DUMMYFOOTERDATA.json";
|
|
17
4
|
import type { FooterProps } from "./Footer.types";
|
|
18
5
|
import { SocialList } from "../../utils/generateSocialList";
|
|
19
6
|
import { NavList } from "../../utils/generateNavMenu";
|
|
@@ -26,16 +13,16 @@ const Footer: React.FC<FooterProps> = ({
|
|
|
26
13
|
src="../../../assets/Logo.png"
|
|
27
14
|
alt="Generic Company Logo."
|
|
28
15
|
background={false}
|
|
29
|
-
additionalClasses="
|
|
16
|
+
additionalClasses="w-40 p-2"
|
|
30
17
|
/>
|
|
31
18
|
),
|
|
32
19
|
hasTitle,
|
|
33
20
|
hasSlogan,
|
|
34
21
|
title,
|
|
35
22
|
slogan,
|
|
36
|
-
backgroundColor,
|
|
37
|
-
logoBorderRadius,
|
|
38
|
-
logoHoverColor,
|
|
23
|
+
backgroundColor = "bg-gray-800",
|
|
24
|
+
logoBorderRadius = "rounded-md",
|
|
25
|
+
logoHoverColor = "hover:bg-gray-700",
|
|
39
26
|
hasNavItems = true,
|
|
40
27
|
hasSocial = true,
|
|
41
28
|
hasContact = true,
|
|
@@ -46,26 +33,16 @@ const Footer: React.FC<FooterProps> = ({
|
|
|
46
33
|
contactData = DUMMYCONTACTDATA,
|
|
47
34
|
socialTitle,
|
|
48
35
|
contactTitle,
|
|
49
|
-
copyRightTextPlacement,
|
|
50
|
-
socialPlacement,
|
|
36
|
+
copyRightTextPlacement = "text-center",
|
|
37
|
+
socialPlacement = "flex justify-center mt-4",
|
|
51
38
|
accordionParentStyle = "border-2 rounded-md border-black p-2 w-full",
|
|
52
39
|
accordionExpandedStyle = "pl-3",
|
|
53
|
-
accordionGap,
|
|
40
|
+
accordionGap = "gap-4",
|
|
54
41
|
}) => {
|
|
55
|
-
|
|
56
|
-
let backgroundColorClasses = getBackgroundColor(backgroundColor);
|
|
57
|
-
let socialPlacementClasses = getSocialPlacement(socialPlacement);
|
|
58
|
-
let copyRightTextPlacementClasses = getCopyRightPlacement(
|
|
59
|
-
copyRightTextPlacement
|
|
60
|
-
);
|
|
42
|
+
const logoClasses = `${logoHoverColor} ${logoBorderRadius}`;
|
|
61
43
|
|
|
62
44
|
return (
|
|
63
|
-
|
|
64
|
-
// not sure if this is a storybook issue, or if it is a code issue
|
|
65
|
-
<footer
|
|
66
|
-
className={`footer flex flex-col ${backgroundColorClasses} py-6 px-6`}
|
|
67
|
-
data-testid="footer"
|
|
68
|
-
>
|
|
45
|
+
<footer className={`footer flex flex-col ${backgroundColor} py-6 px-6`} data-testid="footer">
|
|
69
46
|
<div className="flex justify-between w-full max-xl:px-2 max-lg:flex max-lg:flex-col max-xl:gap-10">
|
|
70
47
|
<div className="max-lg:flex max-lg:justify-between max-lg:w-full">
|
|
71
48
|
<div className={logoClasses}>
|
|
@@ -76,82 +53,42 @@ const Footer: React.FC<FooterProps> = ({
|
|
|
76
53
|
<div data-testid="title-slogan">
|
|
77
54
|
{hasTitle ? (
|
|
78
55
|
<div data-testid="title">{title}</div>
|
|
79
|
-
) :
|
|
80
|
-
<></>
|
|
81
|
-
)}
|
|
56
|
+
) : null}
|
|
82
57
|
{hasSlogan ? (
|
|
83
58
|
<div data-testid="slogan">{slogan}</div>
|
|
84
|
-
) :
|
|
85
|
-
<></>
|
|
86
|
-
)}
|
|
59
|
+
) : null}
|
|
87
60
|
</div>
|
|
88
61
|
</div>
|
|
89
62
|
{hasNavItems ? (
|
|
90
63
|
<>
|
|
91
|
-
<nav
|
|
92
|
-
className={`flex gap-12 max-sm:hidden`}
|
|
93
|
-
aria-label="Site navigation."
|
|
94
|
-
data-testid="footer-site-navigation"
|
|
95
|
-
tabIndex={0}
|
|
96
|
-
>
|
|
64
|
+
<nav className="flex gap-12 max-sm:hidden" aria-label="Site navigation" data-testid="footer-site-navigation" tabIndex={0}>
|
|
97
65
|
<NavList navDataList={navData} />
|
|
98
66
|
</nav>
|
|
99
|
-
<nav
|
|
100
|
-
|
|
101
|
-
aria-label="Site navigation."
|
|
102
|
-
data-testid="footer-mobile-navigation"
|
|
103
|
-
>
|
|
104
|
-
<>
|
|
105
|
-
<Accordion
|
|
106
|
-
navData={navData}
|
|
107
|
-
accordionParentStyle={accordionParentStyle}
|
|
108
|
-
accordionExpandedStyle={
|
|
109
|
-
accordionExpandedStyle
|
|
110
|
-
}
|
|
111
|
-
/>
|
|
112
|
-
</>
|
|
67
|
+
<nav className={`hidden flex-col ${accordionGap} col-span-6 w-3/4 max-sm:w-full max-sm:flex`} aria-label="Site navigation" data-testid="footer-mobile-navigation">
|
|
68
|
+
<Accordion navData={navData} accordionParentStyle={accordionParentStyle} accordionExpandedStyle={accordionExpandedStyle} />
|
|
113
69
|
</nav>
|
|
114
70
|
</>
|
|
115
|
-
) :
|
|
116
|
-
<></>
|
|
117
|
-
)}
|
|
71
|
+
) : null}
|
|
118
72
|
{hasContact ? (
|
|
119
|
-
<div
|
|
120
|
-
|
|
121
|
-
data-testid="footer-contact-info"
|
|
122
|
-
>
|
|
123
|
-
{contactTitle ? contactTitle : <></>}
|
|
73
|
+
<div className="flex flex-col space-between" data-testid="footer-contact-info">
|
|
74
|
+
{contactTitle ? contactTitle : null}
|
|
124
75
|
<FooterContacts contactDataList={contactData} />
|
|
125
76
|
</div>
|
|
126
|
-
) :
|
|
127
|
-
<></>
|
|
128
|
-
)}
|
|
77
|
+
) : null}
|
|
129
78
|
</div>
|
|
130
79
|
{hasSocial ? (
|
|
131
|
-
<nav
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
aria-label="Social media navigation."
|
|
135
|
-
data-testid="footer-social-navigation"
|
|
136
|
-
>
|
|
137
|
-
{socialTitle ? socialTitle : <></>}
|
|
138
|
-
<div className="grid grid-flow-col gap-3">
|
|
80
|
+
<nav className={`w-full ${socialPlacement}`} aria-hidden="false" aria-label="Social media navigation" data-testid="footer-social-navigation">
|
|
81
|
+
{socialTitle ? socialTitle : null}
|
|
82
|
+
<div className="flex justify-center gap-4 mt-4">
|
|
139
83
|
<SocialList socialDataList={socialData} />
|
|
140
84
|
</div>
|
|
141
85
|
</nav>
|
|
142
|
-
) :
|
|
143
|
-
<></>
|
|
144
|
-
)}
|
|
86
|
+
) : null}
|
|
145
87
|
{hasCopyRight ? (
|
|
146
|
-
<div
|
|
147
|
-
className={`w-full ${copyRightTextPlacementClasses}`}
|
|
148
|
-
aria-hidden="false"
|
|
149
|
-
>
|
|
88
|
+
<div className={`w-full ${copyRightTextPlacement}`} aria-hidden="false">
|
|
150
89
|
{copyRightText}
|
|
151
90
|
</div>
|
|
152
|
-
) :
|
|
153
|
-
<></>
|
|
154
|
-
)}
|
|
91
|
+
) : null}
|
|
155
92
|
</footer>
|
|
156
93
|
);
|
|
157
94
|
};
|
|
@@ -45,7 +45,7 @@ export interface FooterProps {
|
|
|
45
45
|
hasSocial?: boolean;
|
|
46
46
|
socialData?: typeof DUMMYSOCIALDATA;
|
|
47
47
|
socialTitle?: React.ReactNode;
|
|
48
|
-
socialPlacement?:
|
|
48
|
+
socialPlacement?: string;
|
|
49
49
|
|
|
50
50
|
// CONTACT
|
|
51
51
|
contactTitle?: React.ReactNode;
|
|
@@ -55,7 +55,7 @@ export interface FooterProps {
|
|
|
55
55
|
// COPYRIGHT
|
|
56
56
|
hasCopyRight?: boolean;
|
|
57
57
|
copyRightText?: React.ReactNode;
|
|
58
|
-
copyRightTextPlacement?:
|
|
58
|
+
copyRightTextPlacement?: string;
|
|
59
59
|
|
|
60
60
|
children?: React.ReactNode;
|
|
61
61
|
}
|