@agilant/toga-blox 1.0.28 → 1.0.30
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/dist/components/BaseButton/BaseButton.d.ts +4 -0
- package/dist/components/BaseButton/BaseButton.js +49 -0
- package/dist/components/BaseButton/BaseButton.stories.d.ts +12 -0
- package/dist/components/BaseButton/BaseButton.stories.js +200 -0
- package/dist/components/BaseButton/BaseButton.test.d.ts +1 -0
- package/dist/components/BaseButton/BaseButton.test.js +57 -0
- package/dist/components/BaseButton/BaseButton.types.d.ts +24 -0
- package/dist/components/BaseButton/BaseButton.types.js +1 -0
- package/dist/components/BaseButton/index.d.ts +2 -0
- package/dist/components/BaseButton/index.js +2 -0
- package/dist/components/Card/DUMMYPRODUCTDATA.json +2 -1
- package/dist/components/Card/templates/CounterContentCardTemplate.js +2 -2
- package/dist/components/Card/templates/HorizontalCardTemplate.js +3 -3
- package/dist/components/Card/templates/ItemCardTemplate.js +2 -2
- package/dist/components/Card/templates/KitContentCardTemplate.js +2 -2
- package/dist/components/Card/templates/ShippingAddressCardTemplate.js +2 -2
- package/dist/components/Card/templates/VerticalCardTemplate.js +2 -2
- package/dist/components/CounterButton/CounterButton.js +2 -2
- package/dist/components/GetSupport/GetSupport.js +2 -2
- package/dist/components/Header/Header.stories.js +3 -3
- package/dist/components/ImageContainer/ImageContainer.d.ts +4 -0
- package/dist/components/ImageContainer/ImageContainer.js +6 -0
- package/dist/components/ImageContainer/ImageContainer.stories.d.ts +7 -0
- package/dist/components/ImageContainer/ImageContainer.stories.js +88 -0
- package/dist/components/ImageContainer/ImageContainer.test.d.ts +1 -0
- package/dist/components/ImageContainer/ImageContainer.test.js +63 -0
- package/dist/components/ImageContainer/ImageContainer.types.d.ts +11 -0
- package/dist/components/ImageContainer/ImageContainer.types.js +1 -0
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Input/Input.stories.js +4 -4
- package/dist/components/Input/Input.test.js +2 -2
- package/dist/components/Page/ViewPageTemplate.stories.js +3 -3
- package/dist/components/Page/ViewPageTemplate.test.js +2 -2
- package/dist/components/PageSection/PageSection.d.ts +1 -1
- package/dist/components/PageSection/PageSection.stories.js +3 -3
- package/dist/components/PageSection/PageSections.test.js +13 -3
- package/dist/components/SearchInput/SearchInput.js +2 -2
- package/dist/components/Text/Text.js +2 -2
- package/dist/components/Text/Text.stories.js +7 -0
- package/dist/components/Text/Text.test.js +7 -1
- package/dist/components/Text/Text.types.d.ts +1 -0
- package/dist/components/Toaster/Toaster.js +3 -3
- package/dist/components/Toaster/Toaster.stories.js +10 -0
- package/dist/components/Toaster/Toaster.types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const BaseButton = ({ onClick, text, fontFamily, backgroundColor, customWidth, customHeight, shape, borderColor, icon, additionalClasses, type = "button", to, href, isDisabled = false, hasShadow, as: Element = "button", hoverBackground, hoverFontColor, hoverUnderline = false, hoverBorderColor, iconClasses, ...props }) => {
|
|
3
|
+
const baseBaseButtonClasses = "flex items-center justify-center";
|
|
4
|
+
const hoverClasses = !isDisabled
|
|
5
|
+
? `${hoverBackground} ${hoverFontColor} ${hoverUnderline ? "underline underline-offset-4" : ""} ${hoverBorderColor}`
|
|
6
|
+
: "";
|
|
7
|
+
const buttonColorClasses = `${backgroundColor} ${borderColor}`;
|
|
8
|
+
const cursorClasses = isDisabled
|
|
9
|
+
? "cursor-not-allowed opacity-50"
|
|
10
|
+
: "cursor-pointer";
|
|
11
|
+
const textStyleClasses = `${fontFamily}`;
|
|
12
|
+
const buttonShapeClasses = shape;
|
|
13
|
+
const buttonClasses = `
|
|
14
|
+
${baseBaseButtonClasses}
|
|
15
|
+
${buttonColorClasses}
|
|
16
|
+
${buttonShapeClasses}
|
|
17
|
+
${textStyleClasses}
|
|
18
|
+
${hoverClasses}
|
|
19
|
+
${cursorClasses}
|
|
20
|
+
${hasShadow ? "shadow-md" : ""}
|
|
21
|
+
${customWidth}
|
|
22
|
+
${customHeight}
|
|
23
|
+
${additionalClasses}
|
|
24
|
+
`.trim();
|
|
25
|
+
const handleClick = (e) => {
|
|
26
|
+
if (isDisabled) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
onClick?.(e);
|
|
31
|
+
};
|
|
32
|
+
const baseProps = {
|
|
33
|
+
className: buttonClasses,
|
|
34
|
+
onClick: handleClick,
|
|
35
|
+
"aria-disabled": isDisabled ? "true" : "false",
|
|
36
|
+
};
|
|
37
|
+
let ElementProps = { ...baseProps };
|
|
38
|
+
if (Element === "a" && href) {
|
|
39
|
+
ElementProps = { ...baseProps, href };
|
|
40
|
+
}
|
|
41
|
+
else if (Element === "button") {
|
|
42
|
+
ElementProps = { ...baseProps, type };
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
ElementProps = { ...baseProps };
|
|
46
|
+
}
|
|
47
|
+
return (_jsxs(Element, { ...ElementProps, ...props, children: [icon && _jsx("span", { className: iconClasses, children: icon }), text] }));
|
|
48
|
+
};
|
|
49
|
+
export default BaseButton;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
declare const _default: Meta;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const Default: any;
|
|
5
|
+
export declare const Compass: any;
|
|
6
|
+
export declare const Disabled: any;
|
|
7
|
+
export declare const WithIcon: any;
|
|
8
|
+
export declare const IconOnly: any;
|
|
9
|
+
export declare const ClearCartButton: any;
|
|
10
|
+
export declare const RightIconButton: any;
|
|
11
|
+
export declare const ConfirmRequestButton: any;
|
|
12
|
+
export declare const FourButtonsRow: any;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import BaseButton from "./BaseButton";
|
|
3
|
+
import Text from "../Text/Text";
|
|
4
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/BaseButton",
|
|
7
|
+
component: BaseButton,
|
|
8
|
+
argTypes: {
|
|
9
|
+
onClick: {
|
|
10
|
+
table: {
|
|
11
|
+
disable: true,
|
|
12
|
+
},
|
|
13
|
+
control: "none",
|
|
14
|
+
},
|
|
15
|
+
text: {
|
|
16
|
+
control: "none",
|
|
17
|
+
description: "The main text displayed on the button.",
|
|
18
|
+
},
|
|
19
|
+
fontFamily: {
|
|
20
|
+
control: "none",
|
|
21
|
+
description: "The font family of the button text.",
|
|
22
|
+
},
|
|
23
|
+
backgroundColor: {
|
|
24
|
+
control: "none",
|
|
25
|
+
description: "The background color of the button. Use Tailwind CSS color classes.",
|
|
26
|
+
},
|
|
27
|
+
borderColor: {
|
|
28
|
+
control: "none",
|
|
29
|
+
description: "The color of the border of the button. Use Tailwind CSS border color classes.",
|
|
30
|
+
},
|
|
31
|
+
shape: {
|
|
32
|
+
control: "none",
|
|
33
|
+
description: "The shape of the button. Use Tailwind CSS border radius classes.",
|
|
34
|
+
},
|
|
35
|
+
hoverBackground: {
|
|
36
|
+
control: "none",
|
|
37
|
+
description: "The background color of the button on hover. Use Tailwind CSS color classes.",
|
|
38
|
+
},
|
|
39
|
+
hoverFontColor: {
|
|
40
|
+
control: "none",
|
|
41
|
+
description: "The text color of the button on hover. Use Tailwind CSS color classes.",
|
|
42
|
+
},
|
|
43
|
+
hoverUnderline: {
|
|
44
|
+
control: "none",
|
|
45
|
+
description: "Whether the text is underlined on hover.",
|
|
46
|
+
},
|
|
47
|
+
hoverBorderColor: {
|
|
48
|
+
control: "none",
|
|
49
|
+
description: "The border color of the button on hover. Use Tailwind CSS border color classes.",
|
|
50
|
+
},
|
|
51
|
+
isDisabled: {
|
|
52
|
+
control: "none",
|
|
53
|
+
description: "Whether the button is disabled and cannot be clicked.",
|
|
54
|
+
},
|
|
55
|
+
hasShadow: {
|
|
56
|
+
control: "none",
|
|
57
|
+
description: "Tailwind CSS class to add a shadow to the button.",
|
|
58
|
+
},
|
|
59
|
+
customWidth: {
|
|
60
|
+
control: "none",
|
|
61
|
+
description: "Custom width for the button. Can be a Tailwind CSS class.",
|
|
62
|
+
},
|
|
63
|
+
customHeight: {
|
|
64
|
+
control: "none",
|
|
65
|
+
description: "Custom height for the button. Can be a Tailwind CSS class.",
|
|
66
|
+
},
|
|
67
|
+
additionalClasses: {
|
|
68
|
+
control: "none",
|
|
69
|
+
description: "Additional Tailwind CSS classes to apply to the button.",
|
|
70
|
+
},
|
|
71
|
+
icon: {
|
|
72
|
+
control: "none",
|
|
73
|
+
description: "An optional icon element to display inside the button.",
|
|
74
|
+
},
|
|
75
|
+
iconClasses: {
|
|
76
|
+
control: "none",
|
|
77
|
+
description: "Classes for styling the icon inside the button.",
|
|
78
|
+
},
|
|
79
|
+
as: {
|
|
80
|
+
control: "none",
|
|
81
|
+
description: "Defines the type of element to render, such as a 'button', 'a', or a React Router 'Link'.",
|
|
82
|
+
},
|
|
83
|
+
href: {
|
|
84
|
+
control: "none",
|
|
85
|
+
description: "If 'as' is 'a', this specifies the 'href' for an anchor element.",
|
|
86
|
+
},
|
|
87
|
+
to: {
|
|
88
|
+
control: "none",
|
|
89
|
+
description: "If 'as' is 'Link', this specifies the 'to' prop for React Router 'Link'.",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
tags: ["autodocs"],
|
|
93
|
+
parameters: {
|
|
94
|
+
docs: {
|
|
95
|
+
description: {
|
|
96
|
+
component: "The `BaseButton` component is a versatile button component that supports different types of elements like `button`, `a`, and `Link` from React Router. It's highly customizable with Tailwind CSS classes.",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
layout: "centered",
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const Template = (args) => _jsx(BaseButton, { ...args });
|
|
103
|
+
export const Default = Template.bind({});
|
|
104
|
+
Default.args = {
|
|
105
|
+
text: "Default Button",
|
|
106
|
+
backgroundColor: "bg-blue-600",
|
|
107
|
+
fontFamily: "font-sans",
|
|
108
|
+
borderColor: "border-none",
|
|
109
|
+
shape: "rounded-md",
|
|
110
|
+
hoverBackground: "hover:bg-blue-700",
|
|
111
|
+
hoverFontColor: "hover:text-black",
|
|
112
|
+
onClick: () => alert("Button clicked!"),
|
|
113
|
+
additionalClasses: "p-2",
|
|
114
|
+
};
|
|
115
|
+
export const Compass = Template.bind({});
|
|
116
|
+
Compass.args = {
|
|
117
|
+
text: _jsx(Text, { size: "", color: "", text: "Compass Button", fontFamily: "" }),
|
|
118
|
+
backgroundColor: "bg-green-400",
|
|
119
|
+
fontFamily: "font-sans",
|
|
120
|
+
shape: "rounded-md",
|
|
121
|
+
borderColor: "border-none",
|
|
122
|
+
hoverBackground: "hover:bg-green-700",
|
|
123
|
+
hoverFontColor: "hover:text-white",
|
|
124
|
+
hoverBorderColor: "hover:border-green-900",
|
|
125
|
+
hoverUnderline: false,
|
|
126
|
+
onClick: () => alert("Button clicked!"),
|
|
127
|
+
as: "a",
|
|
128
|
+
href: "#",
|
|
129
|
+
additionalClasses: "p-2",
|
|
130
|
+
};
|
|
131
|
+
export const Disabled = Template.bind({});
|
|
132
|
+
Disabled.args = {
|
|
133
|
+
...Default.args,
|
|
134
|
+
text: _jsx(Text, { size: "", color: "", text: "Disabled Button", fontFamily: "" }),
|
|
135
|
+
isDisabled: true,
|
|
136
|
+
};
|
|
137
|
+
export const WithIcon = Template.bind({});
|
|
138
|
+
WithIcon.args = {
|
|
139
|
+
...Default.args,
|
|
140
|
+
text: (_jsx(Text, { size: "", color: "", text: "Button with icon", fontFamily: "", additionalClasses: "pl-2" })),
|
|
141
|
+
icon: getFontAwesomeIcon("coffee"),
|
|
142
|
+
shape: "rounded-none",
|
|
143
|
+
hoverUnderline: false,
|
|
144
|
+
onClick: () => alert("Button clicked!"),
|
|
145
|
+
iconClasses: "pl-2",
|
|
146
|
+
};
|
|
147
|
+
export const IconOnly = Template.bind({});
|
|
148
|
+
IconOnly.args = {
|
|
149
|
+
fontFamily: "font-sans",
|
|
150
|
+
shape: "rounded",
|
|
151
|
+
hoverBackground: "hover:bg-gray-100",
|
|
152
|
+
hoverUnderline: false,
|
|
153
|
+
icon: getFontAwesomeIcon("trash"),
|
|
154
|
+
additionalClasses: "flex justify-center items-center px-4 py-3 bg-gray-50",
|
|
155
|
+
onClick: () => alert("Icon button clicked!"),
|
|
156
|
+
};
|
|
157
|
+
export const ClearCartButton = Template.bind({});
|
|
158
|
+
ClearCartButton.args = {
|
|
159
|
+
text: _jsx(Text, { size: "", color: "", text: "Clear Cart", fontFamily: "" }),
|
|
160
|
+
fontFamily: "font-sans",
|
|
161
|
+
shape: "rounded-md",
|
|
162
|
+
hoverBackground: "hover:bg-gray-100",
|
|
163
|
+
hoverFontColor: "hover:text-black",
|
|
164
|
+
hoverBorderColor: "hover:border-red-700",
|
|
165
|
+
hoverUnderline: false,
|
|
166
|
+
icon: getFontAwesomeIcon("trash"),
|
|
167
|
+
iconClasses: "order-first",
|
|
168
|
+
additionalClasses: "px-5 py-6 bg-gray-50 border-red-500 gap-2",
|
|
169
|
+
onClick: () => alert("Cart Cleared!"),
|
|
170
|
+
};
|
|
171
|
+
export const RightIconButton = Template.bind({});
|
|
172
|
+
RightIconButton.args = {
|
|
173
|
+
text: _jsx(Text, { size: "", color: "text-white", text: "Next", fontFamily: "" }),
|
|
174
|
+
backgroundColor: "bg-gray-500",
|
|
175
|
+
shape: "rounded-md",
|
|
176
|
+
hoverBackground: "hover:bg-gray-700",
|
|
177
|
+
hoverFontColor: "hover:text-white",
|
|
178
|
+
hoverBorderColor: "hover:border-blue-700",
|
|
179
|
+
hoverUnderline: false,
|
|
180
|
+
icon: getFontAwesomeIcon("arrowRight"),
|
|
181
|
+
additionalClasses: "px-6 py-3 flex-row-reverse",
|
|
182
|
+
iconClasses: "ml-2 text-white",
|
|
183
|
+
onClick: () => alert("Next clicked!"),
|
|
184
|
+
};
|
|
185
|
+
export const ConfirmRequestButton = Template.bind({});
|
|
186
|
+
ConfirmRequestButton.args = {
|
|
187
|
+
text: _jsx(Text, { size: "", color: "", text: "CONFIRM REQUEST", fontFamily: "" }),
|
|
188
|
+
backgroundColor: "bg-[#9ca3af]",
|
|
189
|
+
fontFamily: "font-sans",
|
|
190
|
+
borderColor: "border-none",
|
|
191
|
+
shape: "rounded-md",
|
|
192
|
+
hoverUnderline: false,
|
|
193
|
+
isDisabled: true,
|
|
194
|
+
additionalClasses: "py-3 px-6",
|
|
195
|
+
};
|
|
196
|
+
export const FourButtonsRow = Template.bind({});
|
|
197
|
+
FourButtonsRow.args = {};
|
|
198
|
+
FourButtonsRow.decorators = [
|
|
199
|
+
(Story) => (_jsxs("div", { className: "flex divide-x divide-gray-200 rounded-md overflow-hidden border border-gray-200", children: [_jsx(BaseButton, { text: "All", backgroundColor: "bg-teal-600", fontFamily: "font-sans", borderColor: "border-gray-200", shape: "rounded-none", hoverUnderline: false, additionalClasses: "py-2 px-4 text-white", onClick: () => alert("All clicked!") }), _jsx(BaseButton, { text: _jsxs(_Fragment, { children: [getFontAwesomeIcon("boxes", "mr-2"), "Bundles"] }), backgroundColor: "bg-white", fontFamily: "font-sans", borderColor: "border-gray-200", shape: "rounded-none", hoverBackground: "hover:bg-teal-600", hoverFontColor: "hover:text-white", hoverBorderColor: "hover:border-none", hoverUnderline: false, additionalClasses: "py-2 px-4", onClick: () => alert("Bundles clicked!") }), _jsx(BaseButton, { text: _jsxs(_Fragment, { children: [getFontAwesomeIcon("clipboard", "mr-2"), "Categories"] }), backgroundColor: "bg-white", fontFamily: "font-sans", borderColor: "border-gray-200", shape: "rounded-none", hoverBackground: "hover:bg-teal-600", hoverFontColor: "hover:text-white", hoverBorderColor: "hover:border-none", hoverUnderline: false, additionalClasses: "py-2 px-4", onClick: () => alert("Categories clicked!") }), _jsx(BaseButton, { text: _jsxs(_Fragment, { children: [getFontAwesomeIcon("plus", "mr-2"), "Custom Categories"] }), backgroundColor: "bg-white", fontFamily: "font-sans", borderColor: "border-gray-200", shape: "rounded-none", hoverBackground: "hover:bg-teal-600", hoverFontColor: "hover:text-white", hoverBorderColor: "hover:border-none", hoverUnderline: false, additionalClasses: "py-2 px-4", onClick: () => alert("Custom Categories clicked!") })] })),
|
|
200
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent } from "@testing-library/react";
|
|
3
|
+
import { describe, expect, test, vi } from "vitest";
|
|
4
|
+
import Button from "./BaseButton";
|
|
5
|
+
import { MemoryRouter } from "react-router-dom";
|
|
6
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
7
|
+
import { faCheck } from "@fortawesome/free-solid-svg-icons";
|
|
8
|
+
describe("Button", () => {
|
|
9
|
+
test("renders correctly", () => {
|
|
10
|
+
render(_jsx(MemoryRouter, { children: _jsx(Button, { text: "Default Button", backgroundColor: "green", shape: "outline" }) }));
|
|
11
|
+
expect(screen.getByText("Default Button")).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
test("is clickable", () => {
|
|
14
|
+
const mockOnClick = vi.fn();
|
|
15
|
+
render(_jsx(MemoryRouter, { children: _jsx(Button, { text: "Clickable Button", backgroundColor: "green", shape: "outline", onClick: mockOnClick }) }));
|
|
16
|
+
fireEvent.click(screen.getByText("Clickable Button"));
|
|
17
|
+
expect(mockOnClick).toHaveBeenCalled();
|
|
18
|
+
});
|
|
19
|
+
test("has correct text", () => {
|
|
20
|
+
render(_jsx(MemoryRouter, { children: _jsx(Button, { text: "Default Button", backgroundColor: "green", shape: "outline" }) }));
|
|
21
|
+
expect(screen.getByText("Default Button")).toHaveTextContent("Default Button");
|
|
22
|
+
});
|
|
23
|
+
test("renders the button with an icon", () => {
|
|
24
|
+
render(_jsx(Button, { text: "Search Button", icon: _jsx(FontAwesomeIcon, { icon: faCheck }) }));
|
|
25
|
+
const buttonElement = screen.getByText("Search Button");
|
|
26
|
+
expect(buttonElement).toHaveTextContent("Search Button");
|
|
27
|
+
const iconElement = screen.getByRole("img", { hidden: true }); // Search for <svg> with role="img"
|
|
28
|
+
expect(iconElement).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("Disabled Button", () => {
|
|
32
|
+
test("is disabled", () => {
|
|
33
|
+
render(_jsx(MemoryRouter, { children: _jsx(Button, { text: "Disabled Button", backgroundColor: "green", shape: "outline", isDisabled: true }) }));
|
|
34
|
+
expect(screen.getByText("Disabled Button")).toHaveAttribute("aria-disabled", "true");
|
|
35
|
+
});
|
|
36
|
+
test("handleClick is not triggered when button is disabled", () => {
|
|
37
|
+
const mockOnClick = vi.fn();
|
|
38
|
+
render(_jsx(MemoryRouter, { children: _jsx(Button, { text: "Disabled Button", backgroundColor: "blue", isDisabled: true, onClick: mockOnClick }) }));
|
|
39
|
+
const button = screen.getByText("Disabled Button");
|
|
40
|
+
fireEvent.click(button);
|
|
41
|
+
expect(mockOnClick).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe("Anchor Button", () => {
|
|
45
|
+
test("renders as an anchor tag with correct attributes when Element='a'", () => {
|
|
46
|
+
render(_jsx(Button, { text: "Anchor Button", as: "a", href: "/test-link" }));
|
|
47
|
+
const anchorElement = screen.getByText("Anchor Button");
|
|
48
|
+
expect(anchorElement.tagName).toBe("A");
|
|
49
|
+
expect(anchorElement).toHaveAttribute("href", "/test-link");
|
|
50
|
+
});
|
|
51
|
+
test("renders as an anchor tag without href attribute", () => {
|
|
52
|
+
render(_jsx(Button, { text: "Anchor Button", as: "a" }));
|
|
53
|
+
const anchorElement = screen.getByText("Anchor Button");
|
|
54
|
+
expect(anchorElement.tagName).toBe("A");
|
|
55
|
+
expect(anchorElement).not.toHaveAttribute("href", "/test-link");
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { ElementType } from "react";
|
|
2
|
+
export interface BaseButtonProps {
|
|
3
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
4
|
+
text?: string | JSX.Element;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
borderColor?: string;
|
|
8
|
+
customWidth?: string;
|
|
9
|
+
customHeight?: string;
|
|
10
|
+
shape?: string;
|
|
11
|
+
icon?: JSX.Element | null;
|
|
12
|
+
additionalClasses?: string;
|
|
13
|
+
type?: "button" | "submit" | "reset";
|
|
14
|
+
to?: string;
|
|
15
|
+
href?: string;
|
|
16
|
+
isDisabled?: boolean;
|
|
17
|
+
hasShadow?: string;
|
|
18
|
+
as?: ElementType | string;
|
|
19
|
+
hoverBackground?: string;
|
|
20
|
+
hoverFontColor?: string;
|
|
21
|
+
hoverUnderline?: boolean;
|
|
22
|
+
hoverBorderColor?: string;
|
|
23
|
+
iconClasses?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -387,7 +387,8 @@
|
|
|
387
387
|
],
|
|
388
388
|
"DUMMYCOMPASSPRODUCTDATA": [
|
|
389
389
|
{
|
|
390
|
-
"id": "1
|
|
390
|
+
"id": "1",
|
|
391
|
+
"title": " Environmental Services - Lenovo ThinkPad Universal USB-C Dock",
|
|
391
392
|
"rating": 5,
|
|
392
393
|
"link": "#",
|
|
393
394
|
"inStock": true,
|
|
@@ -5,7 +5,7 @@ import Image from "../../Image/Image";
|
|
|
5
5
|
import Badge from "../../Badge/Badge";
|
|
6
6
|
import CounterButton from "../../CounterButton/CounterButton";
|
|
7
7
|
import { getFontAwesomeIcon } from "../../../utils/getFontAwesomeIcon";
|
|
8
|
-
import
|
|
8
|
+
import BaseButton from "../../BaseButton";
|
|
9
9
|
const truncateDescription = (description, maxLength) => {
|
|
10
10
|
if (description.length > maxLength) {
|
|
11
11
|
return description.slice(0, maxLength) + "...";
|
|
@@ -41,6 +41,6 @@ const CounterContentCardTemplate = ({ data }) => {
|
|
|
41
41
|
setInCart(false);
|
|
42
42
|
setCount(0);
|
|
43
43
|
};
|
|
44
|
-
return (_jsxs("div", { className: "flex flex-col items-start w-full sm:w-[300px] h-auto sm:h-[350px] border border-[#DFE4EA] bg-white rounded-lg relative p-4 sm:p-4 hover:border-teal-600 hover:shadow-inner", children: [_jsx("div", { className: "absolute top-3 left-3", children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs sm:text-sm" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-green-800" }) }), _jsx("div", { className: "flex justify-center items-center mt-4 w-full", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-[100px] sm:w-[120px] h-[100px] sm:h-[120px] object-contain" }) }), _jsxs("div", { className: "flex flex-col items-start w-full mt-4", children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-md", text: truncateDescription(data.title, 52), color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: `${data.titleProps.additionalClasses} text-left font-bold` }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.identifier, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "text-left mt-1" }), _jsx(Text, { tag: "p", size: "text-xs sm:text-sm", text: truncateDescription(data.description, 52), color: "text-gray-700", fontFamily: "font-sans", additionalClasses: "text-left mt-2" })] }), _jsxs("div", { className: "flex justify-between items-center w-full mt-4 sm:mt-auto", children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-sm sm:text-md", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx("div", { className: "flex items-center gap-2 min-w-[120px] sm:min-w-[150px] justify-end", children: inCart ? (_jsxs(_Fragment, { children: [_jsx(
|
|
44
|
+
return (_jsxs("div", { className: "flex flex-col items-start w-full sm:w-[300px] h-auto sm:h-[350px] border border-[#DFE4EA] bg-white rounded-lg relative p-4 sm:p-4 hover:border-teal-600 hover:shadow-inner", children: [_jsx("div", { className: "absolute top-3 left-3", children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs sm:text-sm" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-green-800" }) }), _jsx("div", { className: "flex justify-center items-center mt-4 w-full", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-[100px] sm:w-[120px] h-[100px] sm:h-[120px] object-contain" }) }), _jsxs("div", { className: "flex flex-col items-start w-full mt-4", children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-md", text: truncateDescription(data.title, 52), color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: `${data.titleProps.additionalClasses} text-left font-bold` }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.identifier, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "text-left mt-1" }), _jsx(Text, { tag: "p", size: "text-xs sm:text-sm", text: truncateDescription(data.description, 52), color: "text-gray-700", fontFamily: "font-sans", additionalClasses: "text-left mt-2" })] }), _jsxs("div", { className: "flex justify-between items-center w-full mt-4 sm:mt-auto", children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-sm sm:text-md", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx("div", { className: "flex items-center gap-2 min-w-[120px] sm:min-w-[150px] justify-end", children: inCart ? (_jsxs(_Fragment, { children: [_jsx(BaseButton, { additionalClasses: "w-6 sm:w-8 h-6 sm:h-8 flex items-center justify-center text-red-600", icon: getFontAwesomeIcon("trash"), onClick: handleDeleteClick }), _jsx(CounterButton, { count: count, onIncrementClick: handleIncrementClick, onDecrementClick: handleDecrementClick, onInputChange: handleInputChange, containerClassName: "flex items-center border border-gray-300 rounded-md overflow-hidden", inputClassName: "w-8 h-8 text-center text-xs sm:text-sm border-none outline-none bg-white", buttonClassName: "w-8 h-8 flex items-center justify-center text-gray-600", iconClasses: "fill-current text-gray-600" })] })) : (_jsx(BaseButton, { text: "Add to Cart", backgroundColor: "bg-teal-600", shape: "rounded-md", borderColor: "border-none", additionalClasses: "w-[100px] sm:w-[120px] h-[32px] sm:h-[40px] hover:bg-teal-800", onClick: handleAddToCartClick })) })] })] }));
|
|
45
45
|
};
|
|
46
46
|
export default CounterContentCardTemplate;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../../Text/Text";
|
|
4
4
|
import Image from "../../Image/Image";
|
|
5
5
|
import { getFontAwesomeIcon } from "../../../utils/getFontAwesomeIcon";
|
|
6
6
|
const HorizontalCardTemplate = ({ data }) => {
|
|
7
|
-
return (_jsxs(_Fragment, { children: [_jsx("a", { href: "#", className: `flex justify-center w-72 max-sm:w-full`, children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText }) }), _jsxs("div", { className: "flex flex-col justify-between w-3/4 h-full p-3 max-sm:w-full", children: [_jsx("div", { className: "flex h-full mb-12 max-sm:mb-2", children: _jsx("a", { href: data.link, children: _jsx(Text, { tag: data.titleProps.tag, size: data.titleProps.size, text: data.title, color: "black", fontFamily: "", additionalClasses: data.titleProps.additionalClasses }) }) }), _jsxs("div", { className: `flex justify-between mb-12 max-sm:flex-col max-sm:items-end max-sm:mb-2`, children: [_jsx("div", { className: "flex items-center space-x-1 rtl:space-x-reverse max-sm:mb-1", children: _jsx(Text, { tag: data.identifierProps.tag, size: data.identifierProps.size, text: data.identifier, color: "", fontFamily: "", additionalClasses: data.identifierProps.additionalClasses }) }), _jsxs("div", { className: "flex items-center justify-center px-2 max-sm:mb-1", children: [_jsx("div", { className: "pr-2 text-xs", children: data.inStock === true
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx("a", { href: "#", className: `flex justify-center w-72 max-sm:w-full`, "data-testid": "card", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText }) }), _jsxs("div", { className: "flex flex-col justify-between w-3/4 h-full p-3 max-sm:w-full", children: [_jsx("div", { className: "flex h-full mb-12 max-sm:mb-2", children: _jsx("a", { href: data.link, children: _jsx(Text, { tag: data.titleProps.tag, size: data.titleProps.size, text: data.title, color: "black", fontFamily: "", additionalClasses: data.titleProps.additionalClasses }) }) }), _jsxs("div", { className: `flex justify-between mb-12 max-sm:flex-col max-sm:items-end max-sm:mb-2`, children: [_jsx("div", { className: "flex items-center space-x-1 rtl:space-x-reverse max-sm:mb-1", children: _jsx(Text, { tag: data.identifierProps.tag, size: data.identifierProps.size, text: data.identifier, color: "", fontFamily: "", additionalClasses: data.identifierProps.additionalClasses }) }), _jsxs("div", { className: "flex items-center justify-center px-2 max-sm:mb-1", children: [_jsx("div", { className: "pr-2 text-xs", children: data.inStock === true
|
|
8
8
|
? getFontAwesomeIcon(data.inStockProps.inStockIcon)
|
|
9
9
|
: getFontAwesomeIcon(data.inStockProps.outOfStockIcon) }), _jsx(Text, { tag: data.inStockProps.tag, size: data.inStockProps.size, text: data.inStock === true
|
|
10
10
|
? "In Stock"
|
|
11
|
-
: "Out of Stock", color: "black", fontFamily: "", additionalClasses: data.inStockProps.additionalClasses })] }), _jsxs("div", { className: "flex px-2 items-center space-x-1 rtl:space-x-reverse max-sm:mb-1", children: [_jsx("svg", { className: "w-4 h-4 text-yellow-300", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 22 20", children: _jsx("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" }) }), _jsx(Text, { tag: data.ratingProps.tag, size: data.ratingProps.size, text: data.rating, color: "", fontFamily: "", additionalClasses: data.ratingProps.additionalClasses })] })] }), _jsxs("div", { className: "flex items-end flex-col w-full max-sm:flex-row max-sm:justify-between", children: [_jsx("div", { className: "px-2", children: _jsx(Text, { tag: data.priceProps.tag, size: data.priceProps.size, text: data.price, color: "black", fontFamily: "", additionalClasses: data.priceProps.additionalClasses }) }), _jsx(
|
|
11
|
+
: "Out of Stock", color: "black", fontFamily: "", additionalClasses: data.inStockProps.additionalClasses })] }), _jsxs("div", { className: "flex px-2 items-center space-x-1 rtl:space-x-reverse max-sm:mb-1", children: [_jsx("svg", { className: "w-4 h-4 text-yellow-300", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 22 20", children: _jsx("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" }) }), _jsx(Text, { tag: data.ratingProps.tag, size: data.ratingProps.size, text: data.rating, color: "", fontFamily: "", additionalClasses: data.ratingProps.additionalClasses })] })] }), _jsxs("div", { className: "flex items-end flex-col w-full max-sm:flex-row max-sm:justify-between", children: [_jsx("div", { className: "px-2", children: _jsx(Text, { tag: data.priceProps.tag, size: data.priceProps.size, text: data.price, color: "black", fontFamily: "", additionalClasses: data.priceProps.additionalClasses }) }), _jsx(BaseButton, { text: data.buttonProps.text, backgroundColor: data.buttonProps.color, shape: data.buttonProps.shape, borderColor: data.buttonProps.borderColor, hoverBackground: data.buttonProps.hoverBackground, additionalClasses: "w-24" })] })] })] }));
|
|
12
12
|
};
|
|
13
13
|
export default HorizontalCardTemplate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../../Text/Text";
|
|
4
4
|
import Image from "../../Image/Image";
|
|
5
5
|
import Badge from "../../Badge/Badge";
|
|
6
6
|
const ItemCardTemplate = ({ data, containerClasses = "", imageContainerClasses = "", titleContainerClasses = "", descriptionContainerClasses = "", priceContainerClasses = "", buttonContainerClasses = "", badgeContainerClasses = "", }) => {
|
|
7
|
-
return (_jsxs("div", { className: `${containerClasses}`, children: [_jsx("div", { className: badgeContainerClasses, children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs sm:text-sm" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-green-800" }) }), _jsx("div", { className: `flex justify-center items-center ${imageContainerClasses}`, children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "object-contain max-h-full" }) }), _jsxs("div", { className: `${titleContainerClasses}`, children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-sm sm:text-md", text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: data.titleProps.additionalClasses }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.identifier, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "mb-1 sm:mb-2" }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.description, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "mb-2 sm:mb-4" }), _jsxs("div", { className: `${priceContainerClasses}`, children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-sm sm:text-md", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(
|
|
7
|
+
return (_jsxs("div", { className: `${containerClasses}`, children: [_jsx("div", { className: badgeContainerClasses, children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs sm:text-sm" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-green-800" }) }), _jsx("div", { className: `flex justify-center items-center ${imageContainerClasses}`, children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "object-contain max-h-full" }) }), _jsxs("div", { className: `${titleContainerClasses}`, children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-sm sm:text-md", text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: data.titleProps.additionalClasses }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.identifier, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "mb-1 sm:mb-2" }), _jsx(Text, { tag: "span", size: "text-xs sm:text-sm", text: data.description, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "mb-2 sm:mb-4" }), _jsxs("div", { className: `${priceContainerClasses}`, children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-sm sm:text-md", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(BaseButton, { text: data.buttonProps.text, backgroundColor: data.buttonProps.color, shape: data.buttonProps.shape, borderColor: data.buttonProps.borderColor, additionalClasses: `${buttonContainerClasses} hover:bg-teal-800` })] })] })] }));
|
|
8
8
|
};
|
|
9
9
|
export default ItemCardTemplate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../../Text/Text";
|
|
4
4
|
import Image from "../../Image/Image";
|
|
5
5
|
import Badge from "../../Badge/Badge";
|
|
6
6
|
const KitContentCardTemplate = ({ data }) => {
|
|
7
|
-
return (_jsxs("div", { className: "flex flex-col items-start w-full sm:w-[244px] h-auto sm:h-[255px] border border-[#DFE4EA] bg-white rounded-lg relative p-3 hover:border-1 hover:border-teal-600 hover:shadow-inner", children: [_jsx("div", { className: "absolute top-2 left-2", children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-yellow-800" }) }), _jsx("div", { className: "flex flex-col items-center gap-2 mt-6 w-full", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-[80px] h-[80px] sm:w-[100px] sm:h-[100px] object-contain" }) }), _jsxs("div", { className: "flex flex-col items-start w-full mt-2", children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-xs sm:text-sm", text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: `${data.titleProps.additionalClasses} text-left` }), _jsx(Text, { tag: "span", size: "text-xs", text: data.identifier, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "text-left" })] }), _jsxs("div", { className: "flex items-end justify-between w-full mt-auto", children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-xs sm:text-sm", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(
|
|
7
|
+
return (_jsxs("div", { className: "flex flex-col items-start w-full sm:w-[244px] h-auto sm:h-[255px] border border-[#DFE4EA] bg-white rounded-lg relative p-3 hover:border-1 hover:border-teal-600 hover:shadow-inner", children: [_jsx("div", { className: "absolute top-2 left-2", children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-xs" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "text-yellow-800" }) }), _jsx("div", { className: "flex flex-col items-center gap-2 mt-6 w-full", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-[80px] h-[80px] sm:w-[100px] sm:h-[100px] object-contain" }) }), _jsxs("div", { className: "flex flex-col items-start w-full mt-2", children: [_jsx(Text, { tag: data.titleProps.tag, size: "text-xs sm:text-sm", text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: `${data.titleProps.additionalClasses} text-left` }), _jsx(Text, { tag: "span", size: "text-xs", text: data.identifier, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "text-left" })] }), _jsxs("div", { className: "flex items-end justify-between w-full mt-auto", children: [_jsx(Text, { tag: data.priceProps.tag, size: "text-xs sm:text-sm", text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(BaseButton, { text: data.buttonProps.text, backgroundColor: "bg-slate-200", shape: data.buttonProps.shape, borderColor: data.buttonProps.borderColor, additionalClasses: "px-2 py-1 cursor-not-allowed", isDisabled: true })] })] }));
|
|
8
8
|
};
|
|
9
9
|
export default KitContentCardTemplate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../../Text/Text";
|
|
4
4
|
import Image from "../../Image/Image";
|
|
5
5
|
import Badge from "../../Badge/Badge";
|
|
6
6
|
const ShippingAddressCardTemplate = ({ data, }) => {
|
|
7
|
-
return (_jsxs("div", { className: "flex flex-col sm:flex-row p-4 sm:p-6 m-4 sm:m-20 border border-[#00B9A8] bg-white rounded-lg w-full relative hover:border-teal-500 hover:shadow-inner", children: [_jsx("div", { className: "flex-shrink-0 w-full sm:w-auto mb-4 sm:mb-0", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-full h-auto sm:h-auto object-contain" }) }), _jsxs("div", { className: "flex flex-col w-full h-full sm:ml-5", children: [_jsx(Badge, { text: _jsx(Text, { color: "text-green-800", fontFamily: "font-serif", tag: "span", text: data.badgeText, size: "text-xs" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "w-[fit-content] h-[fit-content]" }), _jsxs("div", { className: "mt-2 sm:mt-0", children: [_jsx(Text, { tag: "h2", size: "text-lg", text: data.title, color: "text-black", fontFamily: "font-serif", additionalClasses: "font-bold" }), _jsxs("div", { className: "mt-1", children: [_jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine1, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" }), _jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine2, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" }), _jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine3, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" })] })] }), _jsxs("div", { className: "flex flex-row sm:flex-row gap-2 mt-4 sm:mt-20 w-full sm:w-auto", children: [_jsx(
|
|
7
|
+
return (_jsxs("div", { className: "flex flex-col sm:flex-row p-4 sm:p-6 m-4 sm:m-20 border border-[#00B9A8] bg-white rounded-lg w-full relative hover:border-teal-500 hover:shadow-inner", children: [_jsx("div", { className: "flex-shrink-0 w-full sm:w-auto mb-4 sm:mb-0", children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-full h-auto sm:h-auto object-contain" }) }), _jsxs("div", { className: "flex flex-col w-full h-full sm:ml-5", children: [_jsx(Badge, { text: _jsx(Text, { color: "text-green-800", fontFamily: "font-serif", tag: "span", text: data.badgeText, size: "text-xs" }), type: "span", hoverColor: "", backgroundColor: "bg-green-100", badgeContainerClasses: "w-[fit-content] h-[fit-content]" }), _jsxs("div", { className: "mt-2 sm:mt-0", children: [_jsx(Text, { tag: "h2", size: "text-lg", text: data.title, color: "text-black", fontFamily: "font-serif", additionalClasses: "font-bold" }), _jsxs("div", { className: "mt-1", children: [_jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine1, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" }), _jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine2, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" }), _jsx(Text, { tag: "span", size: "text-sm", text: data.addressLine3, color: "text-slate-400", fontFamily: "font-sans", additionalClasses: "block" })] })] }), _jsxs("div", { className: "flex flex-row sm:flex-row gap-2 mt-4 sm:mt-20 w-full sm:w-auto", children: [_jsx(BaseButton, { text: "Edit", backgroundColor: "bg-teal-600", shape: "rounded-md", borderColor: "border-none", additionalClasses: "px-2 py-1 sm:px-4 sm:py-2 hover:bg-teal-800" }), _jsx(BaseButton, { text: "Delete", backgroundColor: "bg-transparent", shape: "rounded-md", borderColor: "border border-red-600", additionalClasses: "px-2 py-1 sm:px-4 sm:py-2 hover:bg-[#FFEBEE]" })] })] })] }));
|
|
8
8
|
};
|
|
9
9
|
export default ShippingAddressCardTemplate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../../Text/Text";
|
|
4
4
|
import Image from "../../Image/Image";
|
|
5
5
|
import Badge from "../../Badge/Badge";
|
|
6
6
|
const VerticalCardTemplate = ({ data, containerClasses = "", imageContainerClasses = "", titleContainerClasses = "", descriptionContainerClasses = "", priceContainerClasses = "", buttonContainerClasses = "", badgeContainerClasses = "", }) => {
|
|
7
|
-
return (_jsxs("div", { className: `${containerClasses} p-4`, children: [_jsx("div", { className: badgeContainerClasses, children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-md" }), type: "span", hoverColor: "", badgeContainerClasses: "text-slate-800", backgroundColor: "bg-slate-100" }) }), _jsx("div", { className: `relative ${imageContainerClasses}`, children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-full h-full object-contain" }) }), _jsxs("div", { className: titleContainerClasses, children: [_jsx("div", { className: "flex flex-col", children: _jsx(Text, { tag: data.titleProps.tag, size: data.titleProps.size, text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: data.titleProps.additionalClasses }) }), _jsx("div", { className: descriptionContainerClasses, children: _jsxs("div", { className: "relative flex items-center gap-2", children: [_jsx("div", { className: "w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden z-10", children: _jsx(Image, { background: false, src: "../../../assets/compass-card-image-4.png", alt: "Icon 1", additionalClasses: "object-cover w-full h-full" }) }), _jsx("div", { className: "w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden -ml-[20px]", children: _jsx(Image, { background: false, src: "../../../assets/compass-card-image-2.png", alt: "Icon 2", additionalClasses: "object-cover w-full h-full" }) }), _jsx(Text, { tag: "span", size: "text-sm", text: data.description, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "ml-4" })] }) }), _jsxs("div", { className: priceContainerClasses, children: [_jsx(Text, { tag: data.priceProps.tag, size: data.priceProps.size, text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(
|
|
7
|
+
return (_jsxs("div", { className: `${containerClasses} p-4`, children: [_jsx("div", { className: badgeContainerClasses, children: _jsx(Badge, { text: _jsx(Text, { color: "", fontFamily: "font-serif", tag: "p", text: data.badgeText, size: "text-md" }), type: "span", hoverColor: "", badgeContainerClasses: "text-slate-800", backgroundColor: "bg-slate-100" }) }), _jsx("div", { className: `relative ${imageContainerClasses}`, children: _jsx(Image, { background: false, src: data.imageUrl, alt: data.altText, additionalClasses: "w-full h-full object-contain" }) }), _jsxs("div", { className: titleContainerClasses, children: [_jsx("div", { className: "flex flex-col", children: _jsx(Text, { tag: data.titleProps.tag, size: data.titleProps.size, text: data.title, color: data.titleProps.fontColor, fontFamily: data.titleProps.fontFamily, additionalClasses: data.titleProps.additionalClasses }) }), _jsx("div", { className: descriptionContainerClasses, children: _jsxs("div", { className: "relative flex items-center gap-2", children: [_jsx("div", { className: "w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden z-10", children: _jsx(Image, { background: false, src: "../../../assets/compass-card-image-4.png", alt: "Icon 1", additionalClasses: "object-cover w-full h-full" }) }), _jsx("div", { className: "w-[30px] h-[30px] rounded-full border border-gray-300 flex items-center justify-center overflow-hidden -ml-[20px]", children: _jsx(Image, { background: false, src: "../../../assets/compass-card-image-2.png", alt: "Icon 2", additionalClasses: "object-cover w-full h-full" }) }), _jsx(Text, { tag: "span", size: "text-sm", text: data.description, color: "text-gray-500", fontFamily: "font-sans", additionalClasses: "ml-4" })] }) }), _jsxs("div", { className: priceContainerClasses, children: [_jsx(Text, { tag: data.priceProps.tag, size: data.priceProps.size, text: data.price, color: data.priceProps.fontColor, fontFamily: data.priceProps.fontFamily, additionalClasses: data.priceProps.additionalClasses }), _jsx(BaseButton, { text: data.buttonProps.text, backgroundColor: data.buttonProps.color, shape: data.buttonProps.shape, borderColor: data.buttonProps.borderColor, additionalClasses: buttonContainerClasses })] })] })] }));
|
|
8
8
|
};
|
|
9
9
|
export default VerticalCardTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../Text/Text";
|
|
4
4
|
const CounterButton = ({ count, containerClassName, inputClassName, buttonClassName, iconClasses, onIncrementClick, onDecrementClick, onInputChange, }) => {
|
|
5
|
-
return (_jsxs("div", { className: containerClassName, children: [_jsx(
|
|
5
|
+
return (_jsxs("div", { className: containerClassName, children: [_jsx(BaseButton, { icon: _jsx("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: iconClasses, children: _jsx("path", { d: "M11.0626 6.43135H0.937598C0.712598 6.43135 0.506348 6.24385 0.506348 6.0001C0.506348 5.7751 0.693848 5.56885 0.937598 5.56885H11.0626C11.2876 5.56885 11.4938 5.75635 11.4938 6.0001C11.4938 6.2251 11.2876 6.43135 11.0626 6.43135Z" }) }), text: _jsx(Text, { size: "", color: "", text: "Decrement", fontFamily: "", additionalClasses: "sr-only" }), backgroundColor: "clear", borderColor: "none", shape: "cornered", additionalClasses: buttonClassName, onClick: onDecrementClick }), _jsx("div", { className: `flex justify-center items-center border-x border-gray-300`, children: _jsx("input", { type: "text", value: count, className: inputClassName, onChange: onInputChange, onFocus: (e) => e.target.select() }) }), _jsx(BaseButton, { icon: _jsxs("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: iconClasses, children: [_jsx("g", { clipPath: "url(#clip0_1032_24236)", children: _jsx("path", { d: "M11.2501 5.5876H6.43135V0.750098C6.43135 0.525098 6.24385 0.318848 6.0001 0.318848C5.7751 0.318848 5.56885 0.506348 5.56885 0.750098V5.5876H0.750098C0.525098 5.5876 0.318848 5.7751 0.318848 6.01885C0.318848 6.24385 0.506348 6.4501 0.750098 6.4501H5.5876V11.2501C5.5876 11.4751 5.7751 11.6813 6.01885 11.6813C6.24385 11.6813 6.4501 11.4938 6.4501 11.2501V6.43135H11.2501C11.4751 6.43135 11.6813 6.24385 11.6813 6.0001C11.6813 5.7751 11.4751 5.5876 11.2501 5.5876Z" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_1032_24236", children: _jsx("rect", { width: 12, height: 12, fill: "white" }) }) })] }), text: _jsx(Text, { size: "", color: "", text: "Increment", fontFamily: "", additionalClasses: "sr-only" }), backgroundColor: "clear", borderColor: "none", shape: "cornered", additionalClasses: buttonClassName, onClick: onIncrementClick })] }));
|
|
6
6
|
};
|
|
7
7
|
export default CounterButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import BaseButton from "../BaseButton/BaseButton";
|
|
3
3
|
import Text from "../Text/Text";
|
|
4
4
|
const GetSupport = ({ as, to, icon, iconClasses, title, titleClasses, subTitle, subTitleClasses, containerClasses, }) => {
|
|
5
|
-
return (_jsx(
|
|
5
|
+
return (_jsx(BaseButton, { as: as, to: to, text: _jsxs("div", { className: `flex items-center gap-4 ${containerClasses}`, children: [_jsx("div", { className: `flex items-center justify-center ${iconClasses}`, children: icon }), _jsxs("div", { className: "flex flex-col", children: [_jsx(Text, { size: "text-md", color: "text-black", text: title, fontFamily: "font-serif", tag: "p", additionalClasses: titleClasses }), subTitle && (_jsx(Text, { size: "text-md", color: "text-black", text: subTitle, fontFamily: "font-serif", tag: "p", additionalClasses: subTitleClasses }))] })] }), backgroundColor: "bg-transparent", borderColor: "border-none", shape: "rounded-md", additionalClasses: containerClasses }));
|
|
6
6
|
};
|
|
7
7
|
export default GetSupport;
|
|
@@ -5,7 +5,7 @@ import Image from "../Image/Image";
|
|
|
5
5
|
import Badge from "../Badge/Badge";
|
|
6
6
|
import Text from "../Text/Text";
|
|
7
7
|
import Input from "../Input/Input";
|
|
8
|
-
import
|
|
8
|
+
import BaseButton from "../BaseButton/BaseButton";
|
|
9
9
|
import { DUMMYCOMPASSNAVDATA, DUMMYNAVDATA } from "../Nav/DUMMYNAVDATA.json";
|
|
10
10
|
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
11
11
|
export default {
|
|
@@ -131,7 +131,7 @@ Default.args = {
|
|
|
131
131
|
),
|
|
132
132
|
badge: (_jsx(Badge, { type: "href", to: "#", hoverColor: "blue", borderColor: "none", mobileIcon: getFontAwesomeIcon("square-phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "text-sm", color: "text-black", fontFamily: "font-serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "text-xs", color: "text-black", fontFamily: "font-serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) })),
|
|
133
133
|
nav: (_jsx(Nav, { navData: DUMMYNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "blue", parentHoverFontColor: "white", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "blue", submenuHoverBackground: "white", submenuHoverBorderStyle: "bottom", submenuHoverBorderColor: "black", mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-blue-700 text-black", accordionExpandedStyle: "pl-2 py-3" })),
|
|
134
|
-
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", hasPlaceholder: true, placeholder: "Search", borderColor: "gray", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(
|
|
134
|
+
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", hasPlaceholder: true, placeholder: "Search", borderColor: "gray", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(BaseButton, { icon: getFontAwesomeIcon("search"), backgroundColor: "blue", hoverBackground: "black", hoverFontColor: "white", additionalClasses: "h-full w-8 justify-center", shape: "none" }), inputWidth: "w-full" })),
|
|
135
135
|
logoBorderRadius: true,
|
|
136
136
|
logoHoverColor: "blue",
|
|
137
137
|
hasIcons: false,
|
|
@@ -188,7 +188,7 @@ Compass.args = {
|
|
|
188
188
|
badge: (_jsx(Badge, { type: "href", to: "#", hoverColor: "green", borderColor: "none", mobileIcon: getFontAwesomeIcon("square-phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "text-sm", color: "text-teal-700", fontFamily: "font-serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "text-xs", color: "text-teal-700", fontFamily: "font-serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) })),
|
|
189
189
|
logo: (_jsx(Image, { src: "../../../assets/compass-logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 p-2" })),
|
|
190
190
|
nav: (_jsx(Nav, { navData: DUMMYCOMPASSNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "none", parentHoverFontColor: "black", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "white", submenuHoverBackground: "green", submenuHoverBorderStyle: "top-bottom", submenuHoverBorderColor: "green", includeSubmenuImages: true, mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-teal-700 text-black", accordionExpandedStyle: "pl-2 py-3" })),
|
|
191
|
-
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", borderColor: "gray", hasPlaceholder: true, placeholder: "Search", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(
|
|
191
|
+
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", borderColor: "gray", hasPlaceholder: true, placeholder: "Search", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(BaseButton, { icon: getFontAwesomeIcon("search"), backgroundColor: "green", hoverBackground: "black", hoverFontColor: "white", additionalClasses: "h-full w-8 justify-center", shape: "none" }), inputWidth: "w-full" })),
|
|
192
192
|
};
|
|
193
193
|
export const NoSearchOrBadge = Template.bind({});
|
|
194
194
|
NoSearchOrBadge.args = {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const ImageContainer = (props) => {
|
|
3
|
+
const { imageUrl, backgroundColor, borderRadius, size, alternativeText, userInitials, additionalClasses, style, imageClasses, } = props;
|
|
4
|
+
return (_jsx("div", { style: style, className: `${borderRadius} ${backgroundColor} ${size} flex items-center justify-center overflow-hidden ${additionalClasses}`, children: imageUrl ? (_jsx("img", { src: imageUrl, alt: alternativeText, className: `${imageClasses}` })) : (_jsx("p", { className: `text-xs text-white w-full h-full flex justify-center items-center `, children: userInitials || "N/A" })) }));
|
|
5
|
+
};
|
|
6
|
+
export default ImageContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
declare const _default: Meta;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const Default: any;
|
|
5
|
+
export declare const ProfileIcon: any;
|
|
6
|
+
export declare const WithoutImage: any;
|
|
7
|
+
export declare const WithInlineBackgroundColor: any;
|