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,70 @@
|
|
|
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
|
+
import * as React from "react";
|
|
13
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { cn } from "../../lib/utils";
|
|
16
|
+
import LUIcon from "../Icons/LUIcon";
|
|
17
|
+
export var color = {
|
|
18
|
+
blue: "bg-blue-600 text-white hover:bg-blue-700 focus-visible:ring-blue-300 active:bg-blue-800 disabled:bg-gray-100 disabled:text-gray-400",
|
|
19
|
+
"blue-light": "bg-blue-100 text-blue-600 hover:bg-blue-700 hover:text-blue-50 active:bg-blue-800 active:text-blue-50",
|
|
20
|
+
red: "bg-red-600 text-white hover:bg-red-700 focus-visible:ring-red-300 active:bg-red-800 disabled:bg-gray-100 disabled:text-gray-400",
|
|
21
|
+
"red-light": "bg-red-100 text-red-600 hover:bg-red-700 hover:text-red-50 focus-visible:bg-red-600 focus-visible:text-red-50 active:bg-red-800 active:text-red-50",
|
|
22
|
+
green: "bg-green-600 text-white hover:bg-green-700 focus-visible:ring-green-300 active:bg-green-800 disabled:bg-gray-100 disabled:text-gray-400",
|
|
23
|
+
yellow: "bg-yellow-500 text-white hover:bg-yellow-600 focus-visible:ring-yellow-200 active:bg-yellow-700 disabled:bg-gray-100 disabled:text-gray-400",
|
|
24
|
+
indigo: "bg-indigo-600 text-white hover:bg-indigo-700 focus-visible:ring-indigo-300 active:bg-indigo-800 disabled:bg-gray-100 disabled:text-gray-400",
|
|
25
|
+
gray: "bg-gray-50 text-gray-950 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
|
|
26
|
+
"light-gray": "bg-gray-900 text-gray-50 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
|
|
27
|
+
};
|
|
28
|
+
export var size = {
|
|
29
|
+
xl: "!p-3.5",
|
|
30
|
+
lg: "!p-3",
|
|
31
|
+
md: "!p-2.5",
|
|
32
|
+
sm: "!p-2.5",
|
|
33
|
+
};
|
|
34
|
+
export var shape = {
|
|
35
|
+
"rounded-sm": "!rounded-sm",
|
|
36
|
+
"rounded-full": "!rounded-full",
|
|
37
|
+
};
|
|
38
|
+
var buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
|
|
39
|
+
variants: {
|
|
40
|
+
color: color,
|
|
41
|
+
size: size,
|
|
42
|
+
shape: shape,
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
color: "blue",
|
|
46
|
+
size: "md",
|
|
47
|
+
shape: "rounded-sm",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
function IconButton(_a) {
|
|
51
|
+
var className = _a.className, color = _a.color, size = _a.size, shape = _a.shape, _b = _a.asChild, asChild = _b === void 0 ? false : _b, icon = _a.icon, props = __rest(_a, ["className", "color", "size", "shape", "asChild", "icon"]);
|
|
52
|
+
var Comp = asChild ? Slot : "button";
|
|
53
|
+
// Map button size to appropriate icon sizes for the icon
|
|
54
|
+
var getIconSize = function () {
|
|
55
|
+
if (size === "xl" || size === "lg") {
|
|
56
|
+
return "xl";
|
|
57
|
+
}
|
|
58
|
+
else if (size === "md") {
|
|
59
|
+
return "lg";
|
|
60
|
+
}
|
|
61
|
+
else if (size === "sm") {
|
|
62
|
+
return "md";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var iconSize = getIconSize();
|
|
66
|
+
return (<Comp data-slot="button" className={cn(buttonVariants({ color: color, size: size, shape: shape, className: className }))} {...props}>
|
|
67
|
+
<LUIcon size={iconSize} data-testid="icon" icon={icon !== null && icon !== void 0 ? icon : ""}/>
|
|
68
|
+
</Comp>);
|
|
69
|
+
}
|
|
70
|
+
export { IconButton, buttonVariants };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { color, IconButton, shape, size } from "./IconButton";
|
|
2
|
+
import { iconList } from "../../utils/iconList";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/Button/IconButton",
|
|
5
|
+
component: IconButton,
|
|
6
|
+
tags: ["autodocs"],
|
|
7
|
+
};
|
|
8
|
+
var Template = function (args) { return (<IconButton icon="chart-simple" size="md" {...args}/>); };
|
|
9
|
+
export var _IconButton = Template.bind({});
|
|
10
|
+
_IconButton.args = {
|
|
11
|
+
icon: "chart-simple",
|
|
12
|
+
};
|
|
13
|
+
_IconButton.argTypes = {
|
|
14
|
+
color: {
|
|
15
|
+
control: {
|
|
16
|
+
type: "select",
|
|
17
|
+
labels: Object.keys(color),
|
|
18
|
+
},
|
|
19
|
+
options: Object.keys(color),
|
|
20
|
+
},
|
|
21
|
+
shape: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "select",
|
|
24
|
+
labels: Object.keys(shape),
|
|
25
|
+
},
|
|
26
|
+
options: Object.keys(shape),
|
|
27
|
+
description: "Select the shape of the button",
|
|
28
|
+
table: {
|
|
29
|
+
defaultValue: { summary: "rounded-sm" },
|
|
30
|
+
type: { summary: "string" },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
control: {
|
|
35
|
+
type: "select",
|
|
36
|
+
labels: Object.keys(size),
|
|
37
|
+
},
|
|
38
|
+
options: Object.keys(size),
|
|
39
|
+
description: "Select the size of the button",
|
|
40
|
+
table: {
|
|
41
|
+
defaultValue: { summary: "md" },
|
|
42
|
+
type: { summary: "string" },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
icon: {
|
|
46
|
+
control: {
|
|
47
|
+
type: "select",
|
|
48
|
+
labels: Object.fromEntries(iconList.map(function (icon) { return [icon.key, icon.label]; })),
|
|
49
|
+
},
|
|
50
|
+
options: iconList.map(function (icon) { return icon.key; }),
|
|
51
|
+
description: "Icon (React component)",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { color, IconButton, shape, size } from "./IconButton";
|
|
3
|
+
describe("Icon Button Component", function () {
|
|
4
|
+
it("renders icon button with required icon prop", function () {
|
|
5
|
+
render(<IconButton icon="chart-simple"/>);
|
|
6
|
+
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
7
|
+
});
|
|
8
|
+
it("calls onClick handler when clicked", function () {
|
|
9
|
+
var handleClick = jest.fn();
|
|
10
|
+
render(<IconButton onClick={handleClick} icon="chart-simple"/>);
|
|
11
|
+
fireEvent.click(screen.getByRole("button"));
|
|
12
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
13
|
+
});
|
|
14
|
+
it("applies correct color, shape, and size classes", function () {
|
|
15
|
+
render(<IconButton color="blue" shape="rounded-full" size="lg" icon="chart-simple"/>);
|
|
16
|
+
var buttonElement = screen.getByRole("button");
|
|
17
|
+
expect(buttonElement).toHaveClass(color["blue"], shape["rounded-full"], size["lg"]);
|
|
18
|
+
});
|
|
19
|
+
it("applies additional className when provided", function () {
|
|
20
|
+
render(<IconButton className="custom-class" icon="chart-simple"/>);
|
|
21
|
+
expect(screen.getByRole("button")).toHaveClass("custom-class");
|
|
22
|
+
});
|
|
23
|
+
it("renders without crashing when all required props are provided", function () {
|
|
24
|
+
render(<IconButton icon="chart-simple"/>);
|
|
25
|
+
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import LuImage from "../Images/LuImage";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Heading } from "../Typography/Heading/heading";
|
|
5
|
+
import { Body } from "../Typography/Body/body";
|
|
6
|
+
import { Button } from "../Button/Button";
|
|
7
|
+
export var ContactProfile = function (_a) {
|
|
8
|
+
var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
|
|
9
|
+
// Normalize mediaPosition based on orientation
|
|
10
|
+
var normalizedMediaPosition = orientation === "horizontal"
|
|
11
|
+
? mediaPosition === "left" || mediaPosition === "right"
|
|
12
|
+
? mediaPosition
|
|
13
|
+
: "right"
|
|
14
|
+
: mediaPosition === "top" || mediaPosition === "bottom"
|
|
15
|
+
? mediaPosition
|
|
16
|
+
: "top";
|
|
17
|
+
// Common image component to avoid repetition
|
|
18
|
+
var ProfileImage = function () { return (_jsx(LuImage, { src: image, width: 240, height: 240, className: "w-full h-full rounded-full max-w-[160px] aspect-square object-cover ".concat(editor === null || editor === void 0 ? void 0 : editor.cardImage), alt: "Image" })); };
|
|
19
|
+
// Common content section (title and description)
|
|
20
|
+
var ContentSection = function (_a) {
|
|
21
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
22
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 ".concat(className), children: [_jsx(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, " line-clamp-2"), children: item === null || item === void 0 ? void 0 : item.description })] }));
|
|
23
|
+
};
|
|
24
|
+
// Common button component
|
|
25
|
+
var ActionButton = function (_a) {
|
|
26
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
27
|
+
return (_jsx(Link, { href: href, passHref: true, className: className, children: _jsx(Button, { endIcon: "angle-right", size: "sm", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn), children: btnLabel }) }));
|
|
28
|
+
};
|
|
29
|
+
// Horizontal layout card
|
|
30
|
+
if (orientation === "horizontal") {
|
|
31
|
+
return (_jsxs("div", { className: "p-5 bg-white rounded-xl inline-flex ".concat(normalizedMediaPosition === "right" ? "flex-row-reverse" : "", " gap-10 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsx(ProfileImage, {}), _jsxs("div", { className: "flex flex-col gap-1 w-full", children: [_jsx(ContentSection, {}), _jsx(ActionButton, { className: "mt-5" })] })] }));
|
|
32
|
+
}
|
|
33
|
+
// Vertical layout card
|
|
34
|
+
return (_jsxs("div", { className: "p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[365px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsxs("div", { className: "flex ".concat(normalizedMediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center"), children: [_jsx(ProfileImage, {}), _jsx(ContentSection, {})] }), _jsx(ActionButton, {})] }));
|
|
35
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import LuImage from "../Images/LuImage";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { Heading } from "../Typography/Heading/heading";
|
|
4
|
+
import { Body } from "../Typography/Body/body";
|
|
5
|
+
import { Button } from "../Button/Button";
|
|
6
|
+
export var ContactProfile = function (_a) {
|
|
7
|
+
var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
|
|
8
|
+
// Normalize mediaPosition based on orientation
|
|
9
|
+
var normalizedMediaPosition = orientation === "horizontal"
|
|
10
|
+
? mediaPosition === "left" || mediaPosition === "right"
|
|
11
|
+
? mediaPosition
|
|
12
|
+
: "right"
|
|
13
|
+
: mediaPosition === "top" || mediaPosition === "bottom"
|
|
14
|
+
? mediaPosition
|
|
15
|
+
: "top";
|
|
16
|
+
// Common image component to avoid repetition
|
|
17
|
+
var ProfileImage = function () { return (<LuImage src={image} width={240} height={240} className={"w-full h-full rounded-full max-w-[160px] aspect-square object-cover ".concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>); };
|
|
18
|
+
// Common content section (title and description)
|
|
19
|
+
var ContentSection = function (_a) {
|
|
20
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
21
|
+
return (<div className={"flex flex-col gap-1 ".concat(className)}>
|
|
22
|
+
<Heading variant="h5-700" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
|
|
23
|
+
{item === null || item === void 0 ? void 0 : item.title}
|
|
24
|
+
</Heading>
|
|
25
|
+
<Body variant="body-md" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardText, " line-clamp-2")}>
|
|
26
|
+
{item === null || item === void 0 ? void 0 : item.description}
|
|
27
|
+
</Body>
|
|
28
|
+
</div>);
|
|
29
|
+
};
|
|
30
|
+
// Common button component
|
|
31
|
+
var ActionButton = function (_a) {
|
|
32
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
33
|
+
return (<Link href={href} passHref className={className}>
|
|
34
|
+
<Button endIcon={"angle-right"} size="sm" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn)}>
|
|
35
|
+
{btnLabel}
|
|
36
|
+
</Button>
|
|
37
|
+
</Link>);
|
|
38
|
+
};
|
|
39
|
+
// Horizontal layout card
|
|
40
|
+
if (orientation === "horizontal") {
|
|
41
|
+
return (<div className={"p-5 bg-white rounded-xl inline-flex ".concat(normalizedMediaPosition === "right" ? "flex-row-reverse" : "", " gap-10 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
42
|
+
<ProfileImage />
|
|
43
|
+
<div className="flex flex-col gap-1 w-full">
|
|
44
|
+
<ContentSection />
|
|
45
|
+
<ActionButton className="mt-5"/>
|
|
46
|
+
</div>
|
|
47
|
+
</div>);
|
|
48
|
+
}
|
|
49
|
+
// Vertical layout card
|
|
50
|
+
return (<div className={"p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[365px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
51
|
+
<div className={"flex ".concat(normalizedMediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center")}>
|
|
52
|
+
<ProfileImage />
|
|
53
|
+
<ContentSection />
|
|
54
|
+
</div>
|
|
55
|
+
<ActionButton />
|
|
56
|
+
</div>);
|
|
57
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ContactProfile } from "./ContactProfile";
|
|
3
|
+
declare const meta: Meta<typeof ContactProfile>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ContactProfile>;
|
|
6
|
+
export declare const ContactProfileHorizontalLeft: Story;
|
|
7
|
+
export declare const ContactProfileHorizontalRight: Story;
|
|
8
|
+
export declare const ContactProfileVerticalTop: Story;
|
|
9
|
+
export declare const ContactProfileVerticalBottom: Story;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { ContactProfile } from "./ContactProfile";
|
|
13
|
+
import { Dummy_Image, Dummy_Para, Dummy_Subtitle, Dummy_Title, Dummy_Url, } from "../../utils/constants";
|
|
14
|
+
var meta = {
|
|
15
|
+
title: "Components/NewCard/ContactProfile",
|
|
16
|
+
component: ContactProfile,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "centered",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
var baseCardArgs = {
|
|
23
|
+
type: "contactProfile",
|
|
24
|
+
item: {
|
|
25
|
+
image: Dummy_Image,
|
|
26
|
+
title: Dummy_Title,
|
|
27
|
+
description: Dummy_Para,
|
|
28
|
+
subtitle: Dummy_Subtitle,
|
|
29
|
+
},
|
|
30
|
+
image: Dummy_Image,
|
|
31
|
+
href: Dummy_Url,
|
|
32
|
+
btnLabel: "View More",
|
|
33
|
+
editor: {
|
|
34
|
+
card: "",
|
|
35
|
+
cardImage: "",
|
|
36
|
+
cardTitle: "",
|
|
37
|
+
cardText: "",
|
|
38
|
+
cardBtn: "",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export var ContactProfileHorizontalLeft = {
|
|
42
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "left" }),
|
|
43
|
+
};
|
|
44
|
+
export var ContactProfileHorizontalRight = {
|
|
45
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "right" }),
|
|
46
|
+
};
|
|
47
|
+
export var ContactProfileVerticalTop = {
|
|
48
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "top" }),
|
|
49
|
+
};
|
|
50
|
+
export var ContactProfileVerticalBottom = {
|
|
51
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "bottom" }),
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { ContactProfile } from "./ContactProfile";
|
|
13
|
+
import { Dummy_Image, Dummy_Para, Dummy_Subtitle, Dummy_Title, Dummy_Url, } from "../../utils/constants";
|
|
14
|
+
var meta = {
|
|
15
|
+
title: "Components/NewCard/ContactProfile",
|
|
16
|
+
component: ContactProfile,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "centered",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
var baseCardArgs = {
|
|
23
|
+
type: "contactProfile",
|
|
24
|
+
item: {
|
|
25
|
+
image: Dummy_Image,
|
|
26
|
+
title: Dummy_Title,
|
|
27
|
+
description: Dummy_Para,
|
|
28
|
+
subtitle: Dummy_Subtitle,
|
|
29
|
+
},
|
|
30
|
+
image: Dummy_Image,
|
|
31
|
+
href: Dummy_Url,
|
|
32
|
+
btnLabel: "View More",
|
|
33
|
+
editor: {
|
|
34
|
+
card: "",
|
|
35
|
+
cardImage: "",
|
|
36
|
+
cardTitle: "",
|
|
37
|
+
cardText: "",
|
|
38
|
+
cardBtn: "",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export var ContactProfileHorizontalLeft = {
|
|
42
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "left" }),
|
|
43
|
+
};
|
|
44
|
+
export var ContactProfileHorizontalRight = {
|
|
45
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "right" }),
|
|
46
|
+
};
|
|
47
|
+
export var ContactProfileVerticalTop = {
|
|
48
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "top" }),
|
|
49
|
+
};
|
|
50
|
+
export var ContactProfileVerticalBottom = {
|
|
51
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "bottom" }),
|
|
52
|
+
};
|
|
@@ -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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import LuImage from "../Images/LuImage";
|
|
14
|
+
import Link from "next/link";
|
|
15
|
+
import { Button } from "../Button/Button";
|
|
16
|
+
import { Body } from "../Typography/Body/body";
|
|
17
|
+
import { Heading } from "../Typography/Heading/heading";
|
|
18
|
+
export var MultiNews = function (_a) {
|
|
19
|
+
var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
|
|
20
|
+
// Common card media component
|
|
21
|
+
var CardMedia = function (_a) {
|
|
22
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
23
|
+
return (_jsx(LuImage, { src: image, width: 240, height: 240, className: "".concat(className, " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage), alt: "Image" }));
|
|
24
|
+
};
|
|
25
|
+
// Common content section
|
|
26
|
+
var CardContent = function (_a) {
|
|
27
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 ".concat(className), children: [_jsx(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-xl", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardText), children: item === null || item === void 0 ? void 0 : item.description })] }));
|
|
29
|
+
};
|
|
30
|
+
// Common button component with conditional shape
|
|
31
|
+
var ActionButton = function (_a) {
|
|
32
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
33
|
+
return (_jsx(Link, { href: href, passHref: true, className: className, children: _jsx(Button, __assign({ endIcon: "angle-right", size: mediaPosition === "middle" ? "xl" : "lg" }, (mediaPosition === "middle" && { shape: "rounded-full" }), { className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn), children: btnLabel })) }));
|
|
34
|
+
};
|
|
35
|
+
// Optional subtitle component
|
|
36
|
+
var Subtitle = function () { return (_jsx(_Fragment, { children: mediaPosition === "middle" && (_jsx(Body, { variant: "body-xl", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardSubtitle), children: item === null || item === void 0 ? void 0 : item.subtitle })) })); };
|
|
37
|
+
// Horizontal layout
|
|
38
|
+
if (orientation === "horizontal") {
|
|
39
|
+
return (_jsxs("div", { className: "p-8 bg-white rounded-2xl inline-flex ".concat(mediaPosition === "right" ? "flex-row-reverse" : "", " gap-5 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsx(CardMedia, { className: "w-full h-full max-w-[240px] aspect-square rounded-lg object-cover" }), _jsxs("div", { className: "flex flex-col gap-1 w-full", children: [_jsx(CardContent, {}), _jsx(ActionButton, { className: "mt-5" })] })] }));
|
|
40
|
+
}
|
|
41
|
+
// Vertical layout
|
|
42
|
+
return (_jsxs("div", { className: "p-8 bg-white rounded-2xl inline-flex flex-col gap-5 max-w-[480px] 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", " gap-5"), children: [_jsx(Subtitle, {}), _jsx(CardMedia, { className: "w-full h-full aspect-16/10 object-cover" }), _jsx(CardContent, {})] }), _jsx(ActionButton, {})] }));
|
|
43
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import LuImage from "../Images/LuImage";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { Button } from "../Button/Button";
|
|
4
|
+
import { Body } from "../Typography/Body/body";
|
|
5
|
+
import { Heading } from "../Typography/Heading/heading";
|
|
6
|
+
export var MultiNews = function (_a) {
|
|
7
|
+
var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
|
|
8
|
+
// Common card media component
|
|
9
|
+
var CardMedia = function (_a) {
|
|
10
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
11
|
+
return (<LuImage src={image} width={240} height={240} className={"".concat(className, " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>);
|
|
12
|
+
};
|
|
13
|
+
// Common content section
|
|
14
|
+
var CardContent = function (_a) {
|
|
15
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
16
|
+
return (<div className={"flex flex-col gap-1 ".concat(className)}>
|
|
17
|
+
<Heading variant="h5-700" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
|
|
18
|
+
{item === null || item === void 0 ? void 0 : item.title}
|
|
19
|
+
</Heading>
|
|
20
|
+
<Body variant="body-xl" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)}>
|
|
21
|
+
{item === null || item === void 0 ? void 0 : item.description}
|
|
22
|
+
</Body>
|
|
23
|
+
</div>);
|
|
24
|
+
};
|
|
25
|
+
// Common button component with conditional shape
|
|
26
|
+
var ActionButton = function (_a) {
|
|
27
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
28
|
+
return (<Link href={href} passHref className={className}>
|
|
29
|
+
<Button endIcon={"angle-right"} size={mediaPosition === "middle" ? "xl" : "lg"} {...(mediaPosition === "middle" && { shape: "rounded-full" })} className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn)}>
|
|
30
|
+
{btnLabel}
|
|
31
|
+
</Button>
|
|
32
|
+
</Link>);
|
|
33
|
+
};
|
|
34
|
+
// Optional subtitle component
|
|
35
|
+
var Subtitle = function () { return (<>
|
|
36
|
+
{mediaPosition === "middle" && (<Body variant="body-xl" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardSubtitle)}>
|
|
37
|
+
{item === null || item === void 0 ? void 0 : item.subtitle}
|
|
38
|
+
</Body>)}
|
|
39
|
+
</>); };
|
|
40
|
+
// Horizontal layout
|
|
41
|
+
if (orientation === "horizontal") {
|
|
42
|
+
return (<div className={"p-8 bg-white rounded-2xl inline-flex ".concat(mediaPosition === "right" ? "flex-row-reverse" : "", " gap-5 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
43
|
+
<CardMedia className="w-full h-full max-w-[240px] aspect-square rounded-lg object-cover"/>
|
|
44
|
+
<div className="flex flex-col gap-1 w-full">
|
|
45
|
+
<CardContent />
|
|
46
|
+
<ActionButton className="mt-5"/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>);
|
|
49
|
+
}
|
|
50
|
+
// Vertical layout
|
|
51
|
+
return (<div className={"p-8 bg-white rounded-2xl inline-flex flex-col gap-5 max-w-[480px] shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
52
|
+
<div className={"flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " gap-5")}>
|
|
53
|
+
<Subtitle />
|
|
54
|
+
<CardMedia className="w-full h-full aspect-16/10 object-cover"/>
|
|
55
|
+
<CardContent />
|
|
56
|
+
</div>
|
|
57
|
+
<ActionButton />
|
|
58
|
+
</div>);
|
|
59
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { MultiNews } from "./MultiNews";
|
|
3
|
+
declare const meta: Meta<typeof MultiNews>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MultiNews>;
|
|
6
|
+
export declare const MultiNewsHorizontalLeft: Story;
|
|
7
|
+
export declare const MultiNewsHorizontalRight: Story;
|
|
8
|
+
export declare const MultiNewsVerticalTop: Story;
|
|
9
|
+
export declare const MultiNewsVerticalBottom: Story;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { MultiNews } from "./MultiNews";
|
|
13
|
+
import { Dummy_Image, Dummy_Para, Dummy_Subtitle, Dummy_Title, Dummy_Url, } from "../../utils/constants";
|
|
14
|
+
var meta = {
|
|
15
|
+
title: "Components/NewCard/MultiNews",
|
|
16
|
+
component: MultiNews,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "centered",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
var baseCardArgs = {
|
|
23
|
+
type: "multipleNews",
|
|
24
|
+
item: {
|
|
25
|
+
image: Dummy_Image,
|
|
26
|
+
title: Dummy_Title,
|
|
27
|
+
description: Dummy_Para,
|
|
28
|
+
subtitle: Dummy_Subtitle,
|
|
29
|
+
},
|
|
30
|
+
image: Dummy_Image,
|
|
31
|
+
href: Dummy_Url,
|
|
32
|
+
btnLabel: "View More",
|
|
33
|
+
editor: {
|
|
34
|
+
card: "",
|
|
35
|
+
cardImage: "",
|
|
36
|
+
cardTitle: "",
|
|
37
|
+
cardText: "",
|
|
38
|
+
cardBtn: "",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export var MultiNewsHorizontalLeft = {
|
|
42
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "left" }),
|
|
43
|
+
};
|
|
44
|
+
export var MultiNewsHorizontalRight = {
|
|
45
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "right" }),
|
|
46
|
+
};
|
|
47
|
+
export var MultiNewsVerticalTop = {
|
|
48
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "top" }),
|
|
49
|
+
};
|
|
50
|
+
export var MultiNewsVerticalBottom = {
|
|
51
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "bottom" }),
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { MultiNews } from "./MultiNews";
|
|
13
|
+
import { Dummy_Image, Dummy_Para, Dummy_Subtitle, Dummy_Title, Dummy_Url, } from "../../utils/constants";
|
|
14
|
+
var meta = {
|
|
15
|
+
title: "Components/NewCard/MultiNews",
|
|
16
|
+
component: MultiNews,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: "centered",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
var baseCardArgs = {
|
|
23
|
+
type: "multipleNews",
|
|
24
|
+
item: {
|
|
25
|
+
image: Dummy_Image,
|
|
26
|
+
title: Dummy_Title,
|
|
27
|
+
description: Dummy_Para,
|
|
28
|
+
subtitle: Dummy_Subtitle,
|
|
29
|
+
},
|
|
30
|
+
image: Dummy_Image,
|
|
31
|
+
href: Dummy_Url,
|
|
32
|
+
btnLabel: "View More",
|
|
33
|
+
editor: {
|
|
34
|
+
card: "",
|
|
35
|
+
cardImage: "",
|
|
36
|
+
cardTitle: "",
|
|
37
|
+
cardText: "",
|
|
38
|
+
cardBtn: "",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export var MultiNewsHorizontalLeft = {
|
|
42
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "left" }),
|
|
43
|
+
};
|
|
44
|
+
export var MultiNewsHorizontalRight = {
|
|
45
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "right" }),
|
|
46
|
+
};
|
|
47
|
+
export var MultiNewsVerticalTop = {
|
|
48
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "top" }),
|
|
49
|
+
};
|
|
50
|
+
export var MultiNewsVerticalBottom = {
|
|
51
|
+
args: __assign(__assign({}, baseCardArgs), { orientation: "vertical", mediaPosition: "bottom" }),
|
|
52
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import LuImage from "../../Images/LuImage";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Heading } from "../../Typography/Heading/heading";
|
|
5
|
+
import { Body } from "../../Typography/Body/body";
|
|
6
|
+
import { Button } from "../../Button/Button";
|
|
7
|
+
export var PostByCategory = function (_a) {
|
|
8
|
+
var item = _a.item, image = _a.image, href = _a.href, btnLabel = _a.btnLabel, editor = _a.editor, mediaPosition = _a.mediaPosition, orientation = _a.orientation;
|
|
9
|
+
// Normalize mediaPosition based on orientation
|
|
10
|
+
var safeMediaPosition = orientation === "horizontal"
|
|
11
|
+
? mediaPosition === "left" || mediaPosition === "right"
|
|
12
|
+
? mediaPosition
|
|
13
|
+
: "right"
|
|
14
|
+
: mediaPosition === "top" || mediaPosition === "bottom"
|
|
15
|
+
? mediaPosition
|
|
16
|
+
: "top";
|
|
17
|
+
// Common card media component to avoid duplication
|
|
18
|
+
var CardMedia = function (_a) {
|
|
19
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
20
|
+
return (_jsx(LuImage, { src: image, width: 240, height: 240, className: "!rounded-lg ".concat(className, " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage), alt: "Image" }));
|
|
21
|
+
};
|
|
22
|
+
// Common content section component
|
|
23
|
+
var CardContent = function (_a) {
|
|
24
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
25
|
+
return (_jsxs("div", { className: "flex flex-col !gap-1 ".concat(className, " "), children: [_jsx(Heading, { variant: "h5-700", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle, " capitalize line-clamp-1 !m-0"), children: item === null || item === void 0 ? void 0 : item.title }), _jsx(Body, { variant: "body-md", className: " ".concat(orientation === "horizontal" ? "line-clamp-1" : "line-clamp-2", " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardText), children: item === null || item === void 0 ? void 0 : item.description })] }));
|
|
26
|
+
};
|
|
27
|
+
// Common button component
|
|
28
|
+
var CardButton = function (_a) {
|
|
29
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
30
|
+
return (_jsx(Link, { href: href || "#", passHref: true, children: _jsx(Button, { endIcon: "angle-right", size: "lg", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn, " max-sm:w-full ").concat(className), children: btnLabel }) }));
|
|
31
|
+
};
|
|
32
|
+
// Horizontal layout
|
|
33
|
+
if (orientation === "horizontal") {
|
|
34
|
+
return (_jsxs("div", { className: "!p-5 rounded-xl grid grid-cols-1 sm:grid-cols-3 max-w-5xl !gap-5 items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsx(CardMedia, { className: "".concat(safeMediaPosition === "right" && " order-last", " w-full aspect-5/4 sm:aspect-square object-cover") }), _jsxs("div", { className: "flex flex-col !gap-1 md:!gap-5 sm:col-span-2 text-center sm:!text-left h-full justify-center", children: [_jsx(CardContent, {}), _jsx(CardButton, {})] })] }));
|
|
35
|
+
}
|
|
36
|
+
// Vertical layout
|
|
37
|
+
return (_jsxs("div", { className: "p-8 rounded-xl 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 w-full ".concat(safeMediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center !gap-5 text-center"), children: [_jsx(CardMedia, { className: "w-full h-full aspect-5/4 object-cover" }), _jsx(CardContent, { className: "h-20" })] }), _jsx(CardButton, {})] }));
|
|
38
|
+
};
|