linkedunion-design-kit 1.6.8 → 1.7.0
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/app/layout.jsx +13 -0
- package/dist/app/page.jsx +5 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/src/components/Accordion/Accordion.stories.js +3 -3
- package/dist/src/components/Accordion/Accordion.stories.jsx +25 -0
- package/dist/src/components/Avatar/Avatar.jsx +17 -0
- package/dist/src/components/Avatar/Avatar.stories.jsx +31 -0
- package/dist/src/components/Avatar/Avatar.test.jsx +51 -0
- package/dist/src/components/Button/Button.jsx +93 -0
- package/dist/src/components/Button/Button.stories.jsx +248 -0
- package/dist/src/components/Button/Button.test.jsx +73 -0
- package/dist/src/components/Button/IconButton.js +1 -1
- package/dist/src/components/Button/IconButton.jsx +70 -0
- package/dist/src/components/Button/IconButton.stories.jsx +53 -0
- package/dist/src/components/Button/IconButton.test.jsx +27 -0
- package/dist/src/components/Card/ContactProfile.d.ts +2 -0
- package/dist/src/components/Card/ContactProfile.js +35 -0
- package/dist/src/components/Card/ContactProfile.jsx +57 -0
- package/dist/src/components/Card/ContactProfile.stories.d.ts +9 -0
- package/dist/src/components/Card/ContactProfile.stories.js +52 -0
- package/dist/src/components/Card/ContactProfile.stories.jsx +52 -0
- package/dist/src/components/Card/MultiNews.d.ts +2 -0
- package/dist/src/components/Card/MultiNews.js +43 -0
- package/dist/src/components/Card/MultiNews.jsx +59 -0
- package/dist/src/components/Card/MultiNews.stories.d.ts +9 -0
- package/dist/src/components/Card/MultiNews.stories.js +52 -0
- package/dist/src/components/Card/MultiNews.stories.jsx +52 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.d.ts +2 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.js +38 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +60 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.d.ts +9 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.js +54 -0
- package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +54 -0
- package/dist/src/components/Card/SinglePost.d.ts +2 -0
- package/dist/src/components/Card/SinglePost.js +10 -0
- package/dist/src/components/Card/SinglePost.jsx +27 -0
- package/dist/src/components/Card/SinglePost.stories.d.ts +7 -0
- package/dist/src/components/Card/SinglePost.stories.js +46 -0
- package/dist/src/components/Card/SinglePost.stories.jsx +46 -0
- package/dist/src/components/Card/card.d.ts +3 -0
- package/dist/src/components/Card/card.js +30 -0
- package/dist/src/components/Card/card.jsx +31 -0
- package/dist/src/components/Card/type.d.ts +24 -0
- package/dist/src/components/Card/type.js +1 -0
- package/dist/src/components/Checkbox/checkbox.stories.jsx +91 -0
- package/dist/src/components/ColorPicker/ColorPicker.jsx +65 -0
- package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +14 -0
- package/dist/src/components/Colors/color.jsx +5 -0
- package/dist/src/components/Colors/color.stories.jsx +20 -0
- package/dist/src/components/Colors/color.test.jsx +23 -0
- package/dist/src/components/Icons/IconList.test.jsx +57 -0
- package/dist/src/components/Icons/IconView.jsx +25 -0
- package/dist/src/components/Icons/IconView.stories.jsx +8 -0
- package/dist/src/components/Icons/LUIcon.js +1 -1
- package/dist/src/components/Icons/LUIcon.jsx +37 -0
- package/dist/src/components/Icons/LUIcon.stories.jsx +63 -0
- package/dist/src/components/Icons/SingleIcon.test.jsx +56 -0
- package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +18 -0
- package/dist/src/components/ImageUploader/imageUploader.jsx +81 -0
- package/dist/src/components/Images/LuImage.jsx +19 -0
- package/dist/src/components/Images/LuImage.stories.jsx +154 -0
- package/dist/src/components/Images/LuImage.test.jsx +44 -0
- package/dist/src/components/Input/Input.stories.jsx +34 -0
- package/dist/src/components/Label/Label.js +4 -4
- package/dist/src/components/Label/Label.jsx +32 -0
- package/dist/src/components/Label/Label.stories.jsx +30 -0
- package/dist/src/components/MediaCard/Card.jsx +36 -0
- package/dist/src/components/MediaCard/Card.stories.jsx +56 -0
- package/dist/src/components/MediaCard/Card.test.jsx +27 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.jsx +22 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.jsx +60 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.jsx +27 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.jsx +87 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.jsx +23 -0
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.jsx +87 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.jsx +24 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.jsx +61 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.jsx +25 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.jsx +87 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.jsx +23 -0
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.jsx +87 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.d.ts +3 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.js +13 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.jsx +30 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.d.ts +5 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.js +40 -0
- package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.jsx +65 -0
- package/dist/src/components/MediaCard/index.d.ts +1 -0
- package/dist/src/components/MediaCard/index.js +4 -0
- package/dist/src/components/MediaCard/type.d.ts +21 -0
- package/dist/src/components/RadioButton/RadioButton.stories.d.ts +9 -0
- package/dist/src/components/RadioButton/RadioButton.stories.js +43 -0
- package/dist/src/components/RadioButton/RadioButton.stories.jsx +40 -0
- package/dist/src/components/RadioButton/radio-button.d.ts +3 -0
- package/dist/src/components/RadioButton/radio-button.js +41 -0
- package/dist/src/components/RadioButton/radio-button.jsx +30 -0
- package/dist/src/components/Slider/Slider.stories.d.ts +148 -0
- package/dist/src/components/Slider/Slider.stories.js +159 -0
- package/dist/src/components/Slider/slider.d.ts +4 -0
- package/dist/src/components/Slider/slider.js +38 -0
- package/dist/src/components/Switch/Switch.stories.jsx +66 -0
- package/dist/src/components/Tabs/Tabs.stories.d.ts +7 -0
- package/dist/src/components/Tabs/Tabs.stories.js +22 -0
- package/dist/src/components/Tabs/Tabs.stories.jsx +29 -0
- package/dist/src/components/Title/Title.jsx +8 -0
- package/dist/src/components/Title/Title.module.css +1 -1
- package/dist/src/components/Title/Title.stories.jsx +37 -0
- package/dist/src/components/Title/Title.test.jsx +24 -0
- package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
- package/dist/src/components/ToolTip/Tooltip.stories.jsx +25 -0
- package/dist/src/components/Typography/Body/Body.stories.jsx +34 -0
- package/dist/src/components/Typography/Body/body.jsx +52 -0
- package/dist/src/components/Typography/Caption/Caption.stories.jsx +24 -0
- package/dist/src/components/Typography/Display/Display.stories.jsx +24 -0
- package/dist/src/components/Typography/Display/display.jsx +39 -0
- package/dist/src/components/Typography/Heading/Heading.stories.jsx +24 -0
- package/dist/src/components/Typography/Heading/heading.d.ts +1 -1
- package/dist/src/components/Typography/Heading/heading.js +15 -15
- package/dist/src/components/Typography/Heading/heading.jsx +60 -0
- package/dist/src/components/ui/accordion.js +3 -3
- package/dist/src/components/ui/accordion.jsx +39 -0
- package/dist/src/components/ui/caption.jsx +25 -0
- package/dist/src/components/ui/checkbox.jsx +24 -0
- package/dist/src/components/ui/input.jsx +18 -0
- package/dist/src/components/ui/radio-button.d.ts +3 -0
- package/dist/src/components/ui/radio-button.js +42 -0
- package/dist/src/components/ui/switch.jsx +61 -0
- package/dist/src/components/ui/tabs.d.ts +7 -0
- package/dist/src/components/ui/tabs.js +43 -0
- package/dist/src/components/ui/tabs.jsx +32 -0
- package/dist/src/components/ui/tooltip.jsx +38 -0
- package/dist/src/components/ui/typography.d.ts +1 -1
- package/dist/src/components/ui/typography.jsx +56 -0
- package/dist/src/utils/constants.d.ts +5 -3
- package/dist/src/utils/constants.js +5 -3
- package/dist/src/utils/iconList.js +15 -0
- package/dist/styles/global.css +404 -51
- package/package.json +7 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { render, screen } from "@testing-library/react";
|
|
38
|
+
import "@testing-library/jest-dom";
|
|
39
|
+
import { PostByCategoryTheme1 } from "./PostByCategoryTheme1";
|
|
40
|
+
import userEvent from "@testing-library/user-event";
|
|
41
|
+
describe("PostByCategoryTheme1 Component", function () {
|
|
42
|
+
var mockProps = {
|
|
43
|
+
id: 1,
|
|
44
|
+
heading: "John Doe",
|
|
45
|
+
body: "Software Engineer",
|
|
46
|
+
image: "https://via.placeholder.com/150",
|
|
47
|
+
btnLabel: "View Profile",
|
|
48
|
+
href: "/profile",
|
|
49
|
+
className: "custom-class",
|
|
50
|
+
};
|
|
51
|
+
it("Render the post by category theme1 with correct body and heading text", function () {
|
|
52
|
+
render(<PostByCategoryTheme1 {...mockProps}/>);
|
|
53
|
+
var headingElement = screen.getByText(mockProps.heading);
|
|
54
|
+
var bodyElement = screen.getByText(mockProps.body);
|
|
55
|
+
expect(headingElement).toBeInTheDocument();
|
|
56
|
+
expect(bodyElement).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
it("renders the button with correct label and icon", function () {
|
|
59
|
+
render(<PostByCategoryTheme1 {...mockProps}/>);
|
|
60
|
+
var buttonElement = screen.getByRole("button", {
|
|
61
|
+
name: mockProps.btnLabel,
|
|
62
|
+
});
|
|
63
|
+
expect(buttonElement).toBeInTheDocument();
|
|
64
|
+
expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
|
|
65
|
+
});
|
|
66
|
+
it("renders the link with the correct href", function () {
|
|
67
|
+
render(<PostByCategoryTheme1 {...mockProps}/>);
|
|
68
|
+
var linkElement = screen.getByRole("link");
|
|
69
|
+
expect(linkElement).toHaveAttribute("href", mockProps.href);
|
|
70
|
+
});
|
|
71
|
+
it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var user, linkElement;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
render(<PostByCategoryTheme1 {...mockProps}/>);
|
|
77
|
+
user = userEvent.setup();
|
|
78
|
+
linkElement = screen.getByRole("link");
|
|
79
|
+
return [4 /*yield*/, user.click(linkElement)];
|
|
80
|
+
case 1:
|
|
81
|
+
_a.sent();
|
|
82
|
+
expect(linkElement).toHaveAttribute("href", mockProps.href);
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); });
|
|
87
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import LuImage from "../../../components/Images/LuImage";
|
|
3
|
+
import { Button } from "../../../components/Button/Button";
|
|
4
|
+
export var PostByCategoryTheme2 = function (props) {
|
|
5
|
+
return (<div data-testid="postByCategory-theme2" className={"p-8 card_bg_PostByCategory_".concat(props.id, " rounded-xl ").concat(props.className, " card_shadow_PostByCategory_").concat(props.id, " flex flex-col items-center w-full")}>
|
|
6
|
+
<div className="w-full max-w-[240px] overflow-hidden aspect-square">
|
|
7
|
+
<LuImage src={props.image} width={240} height={240} className={"w-full h-full object-cover card_PostByCategory_theme2_image_".concat(props === null || props === void 0 ? void 0 : props.id)} alt="Post By Category"/>
|
|
8
|
+
</div>
|
|
9
|
+
<div className={"flex flex-col items-center flex-grow m-5 text-center h-[100px]"}>
|
|
10
|
+
<div className={"text-default card_PostByCategory_title_color_".concat(props.id, " text-2xl font-semibold capitalize line-clamp-1")}>
|
|
11
|
+
{props.heading}
|
|
12
|
+
</div>
|
|
13
|
+
<p className={"card_PostByCategory_description_color_".concat(props.id, " text-base font-extralight line-clamp-2 max-xs:line-clamp-1 max-sm:mt-[7px]")}>
|
|
14
|
+
{props.body}
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
<Link href={props.href} passHref className="w-full no-underline">
|
|
18
|
+
<Button endIcon={"angle-right"} size="lg" className={"rounded justify-between w-full card_PostByCategory_btn_".concat(props.id)}>
|
|
19
|
+
{props.btnLabel}
|
|
20
|
+
</Button>
|
|
21
|
+
</Link>
|
|
22
|
+
</div>);
|
|
23
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { render, screen } from "@testing-library/react";
|
|
38
|
+
import "@testing-library/jest-dom";
|
|
39
|
+
import { PostByCategoryTheme2 } from "./PostByCategoryTheme2";
|
|
40
|
+
import userEvent from "@testing-library/user-event";
|
|
41
|
+
describe("PostByCategoryTheme2 Component", function () {
|
|
42
|
+
var mockProps = {
|
|
43
|
+
id: 1,
|
|
44
|
+
heading: "John Doe",
|
|
45
|
+
body: "Software Engineer",
|
|
46
|
+
image: "https://via.placeholder.com/150",
|
|
47
|
+
btnLabel: "View Profile",
|
|
48
|
+
href: "/profile",
|
|
49
|
+
className: "custom-class",
|
|
50
|
+
};
|
|
51
|
+
it("Render the post by category theme2 with correct body and heading text", function () {
|
|
52
|
+
render(<PostByCategoryTheme2 {...mockProps}/>);
|
|
53
|
+
var headingElement = screen.getByText(mockProps.heading);
|
|
54
|
+
var bodyElement = screen.getByText(mockProps.body);
|
|
55
|
+
expect(headingElement).toBeInTheDocument();
|
|
56
|
+
expect(bodyElement).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
it("renders the button with correct label and icon", function () {
|
|
59
|
+
render(<PostByCategoryTheme2 {...mockProps}/>);
|
|
60
|
+
var buttonElement = screen.getByRole("button", {
|
|
61
|
+
name: mockProps.btnLabel,
|
|
62
|
+
});
|
|
63
|
+
expect(buttonElement).toBeInTheDocument();
|
|
64
|
+
expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
|
|
65
|
+
});
|
|
66
|
+
it("renders the link with the correct href", function () {
|
|
67
|
+
render(<PostByCategoryTheme2 {...mockProps}/>);
|
|
68
|
+
var linkElement = screen.getByRole("link");
|
|
69
|
+
expect(linkElement).toHaveAttribute("href", mockProps.href);
|
|
70
|
+
});
|
|
71
|
+
it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var user, linkElement;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
render(<PostByCategoryTheme2 {...mockProps}/>);
|
|
77
|
+
user = userEvent.setup();
|
|
78
|
+
linkElement = screen.getByRole("link");
|
|
79
|
+
return [4 /*yield*/, user.click(linkElement)];
|
|
80
|
+
case 1:
|
|
81
|
+
_a.sent();
|
|
82
|
+
expect(linkElement).toHaveAttribute("href", mockProps.href);
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); });
|
|
87
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import LuImage from "../../../components/Images/LuImage";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { getCardImageSrc } from "..";
|
|
5
|
+
import { Heading } from "../../../components/Typography/Heading/heading";
|
|
6
|
+
import { Body } from "../../../components/Typography/Body/body";
|
|
7
|
+
import { Button } from "../../../components/Button/Button";
|
|
8
|
+
var VerticalCard = function (_a) {
|
|
9
|
+
var item = _a.item, footer_logo = _a.footer_logo, _b = _a.href, href = _b === void 0 ? "https://www.google.com/" : _b, _c = _a.btnLabel, btnLabel = _c === void 0 ? "View More" : _c, editor = _a.editor, _d = _a.mediaPosition, mediaPosition = _d === void 0 ? "top" : _d, _e = _a.mediaShape, mediaShape = _e === void 0 ? "square" : _e;
|
|
10
|
+
var imageSrc = getCardImageSrc(item === null || item === void 0 ? void 0 : item.image, footer_logo);
|
|
11
|
+
return (_jsxs("div", { className: "p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[480px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsxs("div", { className: "flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center "), children: [_jsx(LuImage, { src: imageSrc, width: 240, height: 240, className: "w-full h-full ".concat(mediaShape === "square" ? "aspect-5/4 " : "aspect-square rounded-full max-w-[160px]", " object-cover ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage), alt: "Image" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs(Heading, { variant: "h5-700", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle), children: [" ", item === null || item === void 0 ? void 0 : item.title] }), _jsx(Body, { variant: "body-md", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardText), children: item === null || item === void 0 ? void 0 : item.description })] })] }), _jsx(Link, { href: href, passHref: true, children: _jsx(Button, { endIcon: "angle-right", size: "md", shape: "rounded-full", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn), children: btnLabel }) })] }));
|
|
12
|
+
};
|
|
13
|
+
export default VerticalCard;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import LuImage from "../../../components/Images/LuImage";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { getCardImageSrc } from "..";
|
|
4
|
+
import { Heading } from "../../../components/Typography/Heading/heading";
|
|
5
|
+
import { Body } from "../../../components/Typography/Body/body";
|
|
6
|
+
import { Button } from "../../../components/Button/Button";
|
|
7
|
+
var VerticalCard = function (_a) {
|
|
8
|
+
var item = _a.item, footer_logo = _a.footer_logo, _b = _a.href, href = _b === void 0 ? "https://www.google.com/" : _b, _c = _a.btnLabel, btnLabel = _c === void 0 ? "View More" : _c, editor = _a.editor, _d = _a.mediaPosition, mediaPosition = _d === void 0 ? "top" : _d, _e = _a.mediaShape, mediaShape = _e === void 0 ? "square" : _e;
|
|
9
|
+
var imageSrc = getCardImageSrc(item === null || item === void 0 ? void 0 : item.image, footer_logo);
|
|
10
|
+
return (<div className={"p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[480px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
11
|
+
<div className={"flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center ")}>
|
|
12
|
+
<LuImage src={imageSrc} width={240} height={240} className={"w-full h-full ".concat(mediaShape === "square" ? "aspect-5/4 " : "aspect-square rounded-full max-w-[160px]", " object-cover ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>
|
|
13
|
+
<div className="flex flex-col gap-1">
|
|
14
|
+
<Heading variant="h5-700" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
|
|
15
|
+
{" "}
|
|
16
|
+
{item === null || item === void 0 ? void 0 : item.title}
|
|
17
|
+
</Heading>
|
|
18
|
+
<Body variant="body-md" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)}>
|
|
19
|
+
{item === null || item === void 0 ? void 0 : item.description}
|
|
20
|
+
</Body>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<Link href={href} passHref>
|
|
24
|
+
<Button endIcon={"angle-right"} size="md" shape="rounded-full" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn)}>
|
|
25
|
+
{btnLabel}
|
|
26
|
+
</Button>
|
|
27
|
+
</Link>
|
|
28
|
+
</div>);
|
|
29
|
+
};
|
|
30
|
+
export default VerticalCard;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import { CardInterface } from "../../../components/Card/type";
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const _VerticalCard: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, CardInterface>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import VerticalCard from "./VerticalCard";
|
|
14
|
+
import Card from "../../../components/Card/card";
|
|
15
|
+
import { Dummy_Para, Dummy_Title } from "../../../utils/constants";
|
|
16
|
+
export default {
|
|
17
|
+
title: "Components/VerticalCard",
|
|
18
|
+
component: VerticalCard,
|
|
19
|
+
};
|
|
20
|
+
var Template = function (args) { return _jsx(Card, __assign({}, args)); };
|
|
21
|
+
export var _VerticalCard = Template.bind({});
|
|
22
|
+
_VerticalCard.args = {
|
|
23
|
+
item: {
|
|
24
|
+
image: "/images/demo-image.jpg",
|
|
25
|
+
title: Dummy_Title,
|
|
26
|
+
description: Dummy_Para,
|
|
27
|
+
},
|
|
28
|
+
type: "postByCategory",
|
|
29
|
+
image: "/images/demo-image.jpg",
|
|
30
|
+
href: "https://www.google.com/",
|
|
31
|
+
btnLabel: "View More",
|
|
32
|
+
editor: {
|
|
33
|
+
card: "",
|
|
34
|
+
cardImage: "",
|
|
35
|
+
cardTitle: "",
|
|
36
|
+
cardText: "",
|
|
37
|
+
cardBtn: "",
|
|
38
|
+
},
|
|
39
|
+
orientation: "horizontal",
|
|
40
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import VerticalCard from "./VerticalCard";
|
|
2
|
+
import Card from "../../../components/Card/card";
|
|
3
|
+
import { Dummy_Para, Dummy_Title } from "../../../utils/constants";
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/VerticalCard",
|
|
6
|
+
component: VerticalCard,
|
|
7
|
+
};
|
|
8
|
+
var Template = function (args) { return <Card {...args}/>; };
|
|
9
|
+
export var _VerticalCard = Template.bind({});
|
|
10
|
+
_VerticalCard.args = {
|
|
11
|
+
item: {
|
|
12
|
+
image: "/images/demo-image.jpg",
|
|
13
|
+
title: Dummy_Title,
|
|
14
|
+
description: Dummy_Para,
|
|
15
|
+
},
|
|
16
|
+
type: "postByCategory",
|
|
17
|
+
image: "/images/demo-image.jpg",
|
|
18
|
+
href: "https://www.google.com/",
|
|
19
|
+
btnLabel: "View More",
|
|
20
|
+
editor: {
|
|
21
|
+
card: "",
|
|
22
|
+
cardImage: "",
|
|
23
|
+
cardTitle: "",
|
|
24
|
+
cardText: "",
|
|
25
|
+
cardBtn: "",
|
|
26
|
+
},
|
|
27
|
+
orientation: "horizontal",
|
|
28
|
+
};
|
|
29
|
+
// _Card.args = {
|
|
30
|
+
// type: SectionTypeEnum.postByCategoriesTheme,
|
|
31
|
+
// image: "/images/demo-image.jpg",
|
|
32
|
+
// heading: "Heading Text",
|
|
33
|
+
// body: "The quick brown fox jumps over the lazy dog.",
|
|
34
|
+
// layout: OrientationEnum.horizontal,
|
|
35
|
+
// btnLabel: "View More",
|
|
36
|
+
// href: "https://www.google.com/",
|
|
37
|
+
// cardStyle: {
|
|
38
|
+
// card_title_color: "",
|
|
39
|
+
// card_description_color: "",
|
|
40
|
+
// card_shadow_toggle: 0,
|
|
41
|
+
// card_shadow_color: "",
|
|
42
|
+
// card_background_color: "",
|
|
43
|
+
// card_button_background_color: "",
|
|
44
|
+
// card_button_text_color: "",
|
|
45
|
+
// card_image_border_color: "",
|
|
46
|
+
// card_image_border_radius: "",
|
|
47
|
+
// card_image_border: "",
|
|
48
|
+
// },
|
|
49
|
+
// id: 1,
|
|
50
|
+
// };
|
|
51
|
+
// _Card.argTypes = {
|
|
52
|
+
// layout: {
|
|
53
|
+
// control: { type: "select" },
|
|
54
|
+
// options: [OrientationEnum.horizontal, OrientationEnum.vertical],
|
|
55
|
+
// },
|
|
56
|
+
// type: {
|
|
57
|
+
// control: {
|
|
58
|
+
// type: "select",
|
|
59
|
+
// labels: Object.fromEntries(
|
|
60
|
+
// sectionTypeList.map((type) => [type.key, type.label]),
|
|
61
|
+
// ),
|
|
62
|
+
// },
|
|
63
|
+
// options: sectionTypeList.map((type) => type.key),
|
|
64
|
+
// },
|
|
65
|
+
// };
|
|
@@ -7,3 +7,7 @@ export var SectionTypeEnum;
|
|
|
7
7
|
SectionTypeEnum["galleryTheme"] = "gallery";
|
|
8
8
|
SectionTypeEnum["albumTheme"] = "album";
|
|
9
9
|
})(SectionTypeEnum || (SectionTypeEnum = {}));
|
|
10
|
+
export function getCardImageSrc(image, footer_logo, fallback) {
|
|
11
|
+
if (fallback === void 0) { fallback = "/images/no-image.svg"; }
|
|
12
|
+
return (image === null || image === void 0 ? void 0 : image.trim()) ? image : footer_logo || fallback;
|
|
13
|
+
}
|
|
@@ -23,4 +23,25 @@ export interface CardProps {
|
|
|
23
23
|
};
|
|
24
24
|
id?: number;
|
|
25
25
|
}
|
|
26
|
+
export interface EditorInterface {
|
|
27
|
+
cardImage?: string;
|
|
28
|
+
card?: string;
|
|
29
|
+
cardTitle?: string;
|
|
30
|
+
cardText?: string;
|
|
31
|
+
cardBtn?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CardDataProps {
|
|
34
|
+
image?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CardInterface {
|
|
39
|
+
mediaPosition?: "top" | "middle";
|
|
40
|
+
mediaShape?: "circle" | "square";
|
|
41
|
+
item?: CardDataProps;
|
|
42
|
+
footer_logo?: string;
|
|
43
|
+
href?: string;
|
|
44
|
+
btnLabel?: string;
|
|
45
|
+
editor?: EditorInterface;
|
|
46
|
+
}
|
|
26
47
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { RadioButton } from "./radio-button";
|
|
3
|
+
declare const meta: Meta<typeof RadioButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof RadioButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithLabel: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const Checked: Story;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { RadioButton } from "./radio-button";
|
|
14
|
+
import { Label } from "../Label/Label";
|
|
15
|
+
var meta = {
|
|
16
|
+
title: "Components/RadioButton",
|
|
17
|
+
component: RadioButton,
|
|
18
|
+
tags: ["autodocs"],
|
|
19
|
+
args: {
|
|
20
|
+
id: "radio-example",
|
|
21
|
+
name: "example",
|
|
22
|
+
value: "option1",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
//Basic Radio (no label)
|
|
27
|
+
export var Default = {
|
|
28
|
+
args: {
|
|
29
|
+
checked: true,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//With Label wrapping the radio
|
|
33
|
+
export var WithLabel = {
|
|
34
|
+
render: function (args) { return (_jsxs(Label, { htmlFor: "radio-with-label", children: [_jsx(RadioButton, __assign({}, args, { id: "radio-with-label" })), "Upload a Video"] })); },
|
|
35
|
+
};
|
|
36
|
+
//Disabled
|
|
37
|
+
export var Disabled = {
|
|
38
|
+
render: function (args) { return (_jsxs(Label, { htmlFor: "radio-disabled", children: [_jsx(RadioButton, __assign({}, args, { id: "radio-disabled", disabled: true })), "Disabled Option"] })); },
|
|
39
|
+
};
|
|
40
|
+
//Checked by default
|
|
41
|
+
export var Checked = {
|
|
42
|
+
render: function (args) { return (_jsxs(Label, { htmlFor: "radio-checked", children: [_jsx(RadioButton, __assign({}, args, { id: "radio-checked", checked: true })), "Pre-selected"] })); },
|
|
43
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RadioButton } from "./radio-button";
|
|
2
|
+
import { Label } from "../Label/Label";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/RadioButton",
|
|
5
|
+
component: RadioButton,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
args: {
|
|
8
|
+
id: "radio-example",
|
|
9
|
+
name: "example",
|
|
10
|
+
value: "option1",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
//Basic Radio (no label)
|
|
15
|
+
export var Default = {
|
|
16
|
+
args: {
|
|
17
|
+
checked: true,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//With Label wrapping the radio
|
|
21
|
+
export var WithLabel = {
|
|
22
|
+
render: function (args) { return (<Label htmlFor="radio-with-label">
|
|
23
|
+
<RadioButton {...args} id="radio-with-label"/>
|
|
24
|
+
Upload a Video
|
|
25
|
+
</Label>); },
|
|
26
|
+
};
|
|
27
|
+
//Disabled
|
|
28
|
+
export var Disabled = {
|
|
29
|
+
render: function (args) { return (<Label htmlFor="radio-disabled">
|
|
30
|
+
<RadioButton {...args} id="radio-disabled" disabled/>
|
|
31
|
+
Disabled Option
|
|
32
|
+
</Label>); },
|
|
33
|
+
};
|
|
34
|
+
//Checked by default
|
|
35
|
+
export var Checked = {
|
|
36
|
+
render: function (args) { return (<Label htmlFor="radio-checked">
|
|
37
|
+
<RadioButton {...args} id="radio-checked" checked/>
|
|
38
|
+
Pre-selected
|
|
39
|
+
</Label>); },
|
|
40
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
import { cn } from "../../lib/utils";
|
|
26
|
+
var RadioButton = React.forwardRef(function (_a, ref) {
|
|
27
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
28
|
+
return (_jsx("input", __assign({ ref: ref, type: "radio", className: cn(
|
|
29
|
+
// Size and shape
|
|
30
|
+
"size-4 shrink-0 rounded-full border",
|
|
31
|
+
// Unchecked state
|
|
32
|
+
"border-gray-400",
|
|
33
|
+
// Checked state
|
|
34
|
+
"checked:border-blue-600 checked:bg-blue-600",
|
|
35
|
+
// Smooth transition
|
|
36
|
+
"transition-all duration-150 ease-in-out",
|
|
37
|
+
// Disabled state
|
|
38
|
+
"disabled:cursor-not-allowed disabled:opacity-50", className) }, props)));
|
|
39
|
+
});
|
|
40
|
+
RadioButton.displayName = "RadioButton";
|
|
41
|
+
export { RadioButton };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
// components/ui/radio-button.tsx
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
import { cn } from "../../lib/utils";
|
|
15
|
+
var RadioButton = React.forwardRef(function (_a, ref) {
|
|
16
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
17
|
+
return (<input ref={ref} type="radio" className={cn(
|
|
18
|
+
// Size and shape
|
|
19
|
+
"size-4 shrink-0 rounded-full border",
|
|
20
|
+
// Unchecked state
|
|
21
|
+
"border-gray-400",
|
|
22
|
+
// Checked state
|
|
23
|
+
"checked:border-blue-600 checked:bg-blue-600",
|
|
24
|
+
// Smooth transition
|
|
25
|
+
"transition-all duration-150 ease-in-out",
|
|
26
|
+
// Disabled state
|
|
27
|
+
"disabled:cursor-not-allowed disabled:opacity-50", className)} {...props}/>);
|
|
28
|
+
});
|
|
29
|
+
RadioButton.displayName = "RadioButton";
|
|
30
|
+
export { RadioButton };
|