blixify-ui-web-mcp 0.1.1
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/README.md +5 -0
- package/lib/components/action/button/README.md +75 -0
- package/lib/components/action/button/button.stories.tsx +138 -0
- package/lib/components/action/buttonGroup/README.md +79 -0
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
- package/lib/components/action/iconButton/README.md +39 -0
- package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
- package/lib/components/action/radioList/README.md +98 -0
- package/lib/components/action/radioList/radioList.stories.tsx +181 -0
- package/lib/components/action/slider/README.md +86 -0
- package/lib/components/action/slider/slider.stories.tsx +133 -0
- package/lib/components/action/textButton/README.md +34 -0
- package/lib/components/action/textButton/textButton.stories.tsx +16 -0
- package/lib/components/action/toggle/README.md +39 -0
- package/lib/components/action/toggle/toggle.stories.tsx +23 -0
- package/lib/components/advanced/collapse/README.md +106 -0
- package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
- package/lib/components/advanced/infoWindow/README.md +69 -0
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
- package/lib/components/advanced/popUp/README.md +95 -0
- package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
- package/lib/components/auth/bareSignIn/README.md +78 -0
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
- package/lib/components/auth/bareSignUp/README.md +130 -0
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
- package/lib/components/auth/signIn/README.md +53 -0
- package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
- package/lib/components/auth/signUp/README.md +136 -0
- package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
- package/lib/components/chart/README.md +13 -0
- package/lib/components/chart/areaChart/README.md +133 -0
- package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
- package/lib/components/chart/barChart/README.md +193 -0
- package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
- package/lib/components/chart/boxPlotChart/README.md +124 -0
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
- package/lib/components/chart/bubbleChart/README.md +166 -0
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
- package/lib/components/chart/card/README.md +107 -0
- package/lib/components/chart/card/card.stories.tsx +89 -0
- package/lib/components/chart/ganttChart/README.md +142 -0
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
- package/lib/components/chart/heatmapChart/README.md +125 -0
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
- package/lib/components/chart/lineChart/README.md +140 -0
- package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
- package/lib/components/chart/pieChart/README.md +117 -0
- package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
- package/lib/components/chart/polarAreaChart/README.md +126 -0
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
- package/lib/components/chart/radarChart/README.md +57 -0
- package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
- package/lib/components/chart/radialBar/README.md +152 -0
- package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
- package/lib/components/chart/rangeBarChart/README.md +323 -0
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
- package/lib/components/chart/statsCard/README.md +97 -0
- package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
- package/lib/components/chart/treemapChart/README.md +142 -0
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
- package/lib/components/chat/chatAnchor/README.md +113 -0
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
- package/lib/components/chat/chatBase/README.md +223 -0
- package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
- package/lib/components/chat/chatDashboard/README.md +161 -0
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
- package/lib/components/data/dataGraph/README.md +13 -0
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
- package/lib/components/data/dataReference/README.md +62 -0
- package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
- package/lib/components/data/dataTemplate/README.md +903 -0
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
- package/lib/components/data/dataWrapper/README.md +1077 -0
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
- package/lib/components/data/queryForm/README.md +56 -0
- package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
- package/lib/components/data/readQuery/README.md +282 -0
- package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
- package/lib/components/data/readQueryHoc/README.md +89 -0
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
- package/lib/components/data/writeQuery/README.md +178 -0
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
- package/lib/components/design/actionSection/README.md +47 -0
- package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
- package/lib/components/design/banner/README.md +43 -0
- package/lib/components/design/banner/banner.stories.tsx +34 -0
- package/lib/components/design/bannerAction/README.md +44 -0
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
- package/lib/components/design/blogSection/README.md +111 -0
- package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
- package/lib/components/design/carouselSection/README.md +82 -0
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
- package/lib/components/design/designList/README.md +60 -0
- package/lib/components/design/designList/designList.stories.tsx +44 -0
- package/lib/components/design/faq/README.md +121 -0
- package/lib/components/design/faq/faq.stories.tsx +103 -0
- package/lib/components/design/fileGrid/README.md +87 -0
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
- package/lib/components/design/fileViewer/README.md +40 -0
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
- package/lib/components/design/footerSection/README.md +62 -0
- package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
- package/lib/components/design/googleReview/README.md +45 -0
- package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
- package/lib/components/design/heroSection/README.md +48 -0
- package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
- package/lib/components/design/iconList/README.md +60 -0
- package/lib/components/design/iconList/iconList.stories.tsx +41 -0
- package/lib/components/design/imageGallery/README.md +56 -0
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
- package/lib/components/design/imageZoom/README.md +47 -0
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
- package/lib/components/design/leftContent/README.md +47 -0
- package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
- package/lib/components/design/logoCloud/README.md +42 -0
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
- package/lib/components/design/onboarding/README.md +100 -0
- package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
- package/lib/components/design/pricing/README.md +112 -0
- package/lib/components/design/pricing/pricing.stories.tsx +86 -0
- package/lib/components/design/rightContent/README.md +47 -0
- package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
- package/lib/components/design/sectionList/README.md +51 -0
- package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
- package/lib/components/design/teams/README.md +62 -0
- package/lib/components/design/teams/teams.stories.tsx +61 -0
- package/lib/components/display/alert/README.md +82 -0
- package/lib/components/display/alert/alert.stories.tsx +71 -0
- package/lib/components/display/calendar/README.md +113 -0
- package/lib/components/display/calendar/calendar.stories.tsx +159 -0
- package/lib/components/display/clipboard/README.md +36 -0
- package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
- package/lib/components/display/detailList/README.md +61 -0
- package/lib/components/display/detailList/detailList.stories.tsx +131 -0
- package/lib/components/display/drawer/README.md +74 -0
- package/lib/components/display/drawer/drawer.stories.tsx +66 -0
- package/lib/components/display/emptyState/README.md +38 -0
- package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
- package/lib/components/display/feeds/README.md +80 -0
- package/lib/components/display/feeds/feeds.stories.tsx +75 -0
- package/lib/components/display/flexTable/README.md +160 -0
- package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
- package/lib/components/display/grid/README.md +121 -0
- package/lib/components/display/grid/grid.stories.tsx +234 -0
- package/lib/components/display/kanban/README.md +78 -0
- package/lib/components/display/kanban/kanban.stories.tsx +133 -0
- package/lib/components/display/list/README.md +109 -0
- package/lib/components/display/list/list.stories.tsx +188 -0
- package/lib/components/display/loading/README.md +25 -0
- package/lib/components/display/loading/loading.stories.tsx +15 -0
- package/lib/components/display/mapView/README.md +99 -0
- package/lib/components/display/mapView/mapView.stories.tsx +225 -0
- package/lib/components/display/modal/README.md +43 -0
- package/lib/components/display/modal/modal.stories.tsx +81 -0
- package/lib/components/display/notification/README.md +43 -0
- package/lib/components/display/notification/notification.stories.tsx +30 -0
- package/lib/components/display/progress/README.md +25 -0
- package/lib/components/display/progress/progress.stories.tsx +15 -0
- package/lib/components/display/stepper/README.md +96 -0
- package/lib/components/display/stepper/stepper.stories.tsx +175 -0
- package/lib/components/display/table/README.md +176 -0
- package/lib/components/display/table/table.stories.tsx +330 -0
- package/lib/components/display/tag/README.md +74 -0
- package/lib/components/display/tag/tag.stories.tsx +79 -0
- package/lib/components/input/address/README.md +132 -0
- package/lib/components/input/address/address.stories.tsx +147 -0
- package/lib/components/input/canvas/README.md +131 -0
- package/lib/components/input/canvas/canvas.stories.tsx +165 -0
- package/lib/components/input/checkbox/README.md +61 -0
- package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
- package/lib/components/input/datePicker/README.md +124 -0
- package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
- package/lib/components/input/form/README.md +55 -0
- package/lib/components/input/form/form.stories.tsx +143 -0
- package/lib/components/input/markdown/README.md +146 -0
- package/lib/components/input/markdown/markdown.stories.tsx +40 -0
- package/lib/components/input/monthYearPicker/README.md +69 -0
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
- package/lib/components/input/netPromoterScore/README.md +52 -0
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
- package/lib/components/input/rating/README.md +51 -0
- package/lib/components/input/rating/rating.stories.tsx +30 -0
- package/lib/components/input/select/README.md +108 -0
- package/lib/components/input/select/select.stories.tsx +286 -0
- package/lib/components/input/signature/README.md +106 -0
- package/lib/components/input/signature/signature.stories.tsx +188 -0
- package/lib/components/input/textArea/README.md +55 -0
- package/lib/components/input/textArea/textArea.stories.tsx +30 -0
- package/lib/components/input/textInput/README.md +81 -0
- package/lib/components/input/textInput/textinput.stories.tsx +231 -0
- package/lib/components/input/uploadInput/README.md +134 -0
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
- package/lib/components/navigation/bars/README.md +40 -0
- package/lib/components/navigation/bars/bars.stories.tsx +85 -0
- package/lib/components/navigation/bottomTab/README.md +53 -0
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
- package/lib/components/navigation/breadcrumb/README.md +48 -0
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
- package/lib/components/navigation/header/README.md +149 -0
- package/lib/components/navigation/header/header.stories.tsx +107 -0
- package/lib/components/navigation/leftNav/README.md +91 -0
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
- package/lib/components/navigation/tabs/README.md +75 -0
- package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
- package/lib/components/structure/column/README.md +40 -0
- package/lib/components/structure/column/column.stories.tsx +26 -0
- package/lib/components/structure/container/README.md +34 -0
- package/lib/components/structure/container/container.stories.tsx +19 -0
- package/lib/components/structure/link/README.md +55 -0
- package/lib/components/structure/link/link.stories.tsx +30 -0
- package/lib/components/structure/text/README.md +42 -0
- package/lib/components/structure/text/text.stories.tsx +39 -0
- package/lib/components/template/authPage/authPage.stories.tsx +68 -0
- package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
- package/lib/components/template/productListing/productListing.stories.tsx +297 -0
- package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
- package/lib/mcp/server.d.ts +2 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +33 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
- package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getBackendComponent.js +119 -0
- package/lib/mcp/tools/getBackendComponent.js.map +1 -0
- package/lib/mcp/tools/getComponent.d.ts +17 -0
- package/lib/mcp/tools/getComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getComponent.js +118 -0
- package/lib/mcp/tools/getComponent.js.map +1 -0
- package/lib/mcp/tools/listComponents.d.ts +13 -0
- package/lib/mcp/tools/listComponents.d.ts.map +1 -0
- package/lib/mcp/tools/listComponents.js +113 -0
- package/lib/mcp/tools/listComponents.js.map +1 -0
- package/lib/mcp/tools/listTemplates.d.ts +13 -0
- package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
- package/lib/mcp/tools/listTemplates.js +68 -0
- package/lib/mcp/tools/listTemplates.js.map +1 -0
- package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
- package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
- package/lib/mcp/tools/suggestTemplate.js +212 -0
- package/lib/mcp/tools/suggestTemplate.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { QuestionMarkCircleIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
|
2
|
+
import { CheckCircleIcon, ClockIcon } from "@heroicons/react/24/solid";
|
|
3
|
+
import { storiesOf } from "@storybook/react";
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { Button } from "../../action/button";
|
|
6
|
+
import { Option, Select } from "../../input/select";
|
|
7
|
+
import { Container } from "../../structure/container";
|
|
8
|
+
|
|
9
|
+
const qtyOptions: Option[] = [1, 2, 3, 4, 5].map((n) => ({
|
|
10
|
+
key: String(n),
|
|
11
|
+
label: String(n),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const stories = storiesOf("Template", module).addParameters({
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component:
|
|
18
|
+
"Full-page e-commerce templates combining multiple components into ready-to-use layouts. These templates demonstrate real-world compositions of Container, Button, and Select for cart management with live quantity updates and order summary.",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const PRODUCT_IMG =
|
|
24
|
+
"https://plus.unsplash.com/premium_photo-1669905375318-87c4050418cd?q=80&w=687&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D";
|
|
25
|
+
|
|
26
|
+
interface CartItem {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
color: string;
|
|
30
|
+
size: string;
|
|
31
|
+
price: number;
|
|
32
|
+
image: string;
|
|
33
|
+
status: "instock" | "ships";
|
|
34
|
+
qty: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const initialItems: CartItem[] = [
|
|
38
|
+
{
|
|
39
|
+
id: "1",
|
|
40
|
+
name: "Golden Barrel Cactus",
|
|
41
|
+
color: "Bright Green",
|
|
42
|
+
size: 'Small (4")',
|
|
43
|
+
price: 18.0,
|
|
44
|
+
image: PRODUCT_IMG,
|
|
45
|
+
status: "instock",
|
|
46
|
+
qty: "1",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "2",
|
|
50
|
+
name: "Saguaro Cactus",
|
|
51
|
+
color: "Blue-Green",
|
|
52
|
+
size: 'Medium (8")',
|
|
53
|
+
price: 34.0,
|
|
54
|
+
image: PRODUCT_IMG,
|
|
55
|
+
status: "ships",
|
|
56
|
+
qty: "1",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "3",
|
|
60
|
+
name: "Prickly Pear Cactus",
|
|
61
|
+
color: "Dusty Green",
|
|
62
|
+
size: 'Large (12")',
|
|
63
|
+
price: 28.0,
|
|
64
|
+
image: PRODUCT_IMG,
|
|
65
|
+
status: "instock",
|
|
66
|
+
qty: "1",
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const SHIPPING = 5.0;
|
|
71
|
+
const TAX_RATE = 0.084;
|
|
72
|
+
|
|
73
|
+
stories.add("Shopping Cart", () => {
|
|
74
|
+
const [items, setItems] = useState<CartItem[]>(initialItems);
|
|
75
|
+
|
|
76
|
+
const handleRemove = (id: string) =>
|
|
77
|
+
setItems((prev) => prev.filter((i) => i.id !== id));
|
|
78
|
+
const handleQtyChange = (id: string, qty: string) =>
|
|
79
|
+
setItems((prev) => prev.map((i) => (i.id === id ? { ...i, qty } : i)));
|
|
80
|
+
|
|
81
|
+
const subtotal = items.reduce(
|
|
82
|
+
(sum, item) => sum + item.price * Number(item.qty),
|
|
83
|
+
0
|
|
84
|
+
);
|
|
85
|
+
const tax = subtotal * TAX_RATE;
|
|
86
|
+
const total = subtotal + SHIPPING + tax;
|
|
87
|
+
|
|
88
|
+
const StockStatus = ({ status }: { status: CartItem["status"] }) =>
|
|
89
|
+
status === "instock" ? (
|
|
90
|
+
<div className="flex items-center gap-1 text-green-500 text-sm">
|
|
91
|
+
<CheckCircleIcon className="h-4 w-4" />
|
|
92
|
+
<span>In stock</span>
|
|
93
|
+
</div>
|
|
94
|
+
) : (
|
|
95
|
+
<div className="flex items-center gap-1 text-gray-400 text-sm">
|
|
96
|
+
<ClockIcon className="h-4 w-4" />
|
|
97
|
+
<span>Ships in 3-4 weeks</span>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Container bgColor="bg-white">
|
|
103
|
+
<h1 className="text-2xl font-semibold text-gray-900 mb-6">
|
|
104
|
+
Shopping Cart
|
|
105
|
+
</h1>
|
|
106
|
+
<div className="flex flex-col lg:flex-row gap-8">
|
|
107
|
+
<div className="flex-1 divide-y divide-gray-200 border-t border-b border-gray-200">
|
|
108
|
+
{items.map((item) => (
|
|
109
|
+
<div key={item.id} className="flex gap-3 py-6">
|
|
110
|
+
{/* Image */}
|
|
111
|
+
<div className="w-24 h-24 sm:w-36 sm:h-36 flex-shrink-0 overflow-hidden rounded-md">
|
|
112
|
+
<img
|
|
113
|
+
src={item.image}
|
|
114
|
+
alt={item.name}
|
|
115
|
+
className="w-full h-full object-cover object-center"
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Mobile: stacked */}
|
|
120
|
+
<div className="flex flex-1 flex-col min-w-0 sm:hidden">
|
|
121
|
+
<div className="flex items-start justify-between gap-2">
|
|
122
|
+
<p className="text-sm font-medium text-gray-900">
|
|
123
|
+
{item.name}
|
|
124
|
+
</p>
|
|
125
|
+
<button
|
|
126
|
+
onClick={() => handleRemove(item.id)}
|
|
127
|
+
className="text-gray-400 hover:text-gray-600 flex-shrink-0"
|
|
128
|
+
>
|
|
129
|
+
<XMarkIcon className="h-5 w-5" />
|
|
130
|
+
</button>
|
|
131
|
+
</div>
|
|
132
|
+
<div className="flex items-center gap-1 mt-1">
|
|
133
|
+
<span className="text-sm text-gray-500">{item.color}</span>
|
|
134
|
+
<span className="text-gray-300 text-xs">|</span>
|
|
135
|
+
<span className="text-sm text-gray-500">{item.size}</span>
|
|
136
|
+
</div>
|
|
137
|
+
<p className="mt-1 text-sm font-medium text-gray-900">
|
|
138
|
+
RM {item.price.toFixed(2)}
|
|
139
|
+
</p>
|
|
140
|
+
<div className="mt-3 w-20">
|
|
141
|
+
<Select
|
|
142
|
+
label=""
|
|
143
|
+
value={item.qty}
|
|
144
|
+
options={qtyOptions}
|
|
145
|
+
disableKeyboard
|
|
146
|
+
onChange={(val: string) => {
|
|
147
|
+
if (val) handleQtyChange(item.id, val);
|
|
148
|
+
}}
|
|
149
|
+
placeholder="Qty"
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
<div className="mt-2">
|
|
153
|
+
<StockStatus status={item.status} />
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{/* Desktop: image | info (top) + status (bottom) | qty (top) | X (top) */}
|
|
158
|
+
<div className="hidden sm:flex flex-1 min-w-0 items-stretch gap-4">
|
|
159
|
+
{/* Info column: name/color/price top, status bottom */}
|
|
160
|
+
<div className="flex-1 min-w-0 flex flex-col justify-between">
|
|
161
|
+
<div>
|
|
162
|
+
<p className="text-sm font-medium text-gray-900">
|
|
163
|
+
{item.name}
|
|
164
|
+
</p>
|
|
165
|
+
<div className="flex items-center gap-1 mt-1">
|
|
166
|
+
<span className="text-sm text-gray-500">
|
|
167
|
+
{item.color}
|
|
168
|
+
</span>
|
|
169
|
+
<span className="text-gray-300 text-xs">|</span>
|
|
170
|
+
<span className="text-sm text-gray-500">{item.size}</span>
|
|
171
|
+
</div>
|
|
172
|
+
<p className="mt-1 text-sm font-medium text-gray-900">
|
|
173
|
+
RM {item.price.toFixed(2)}
|
|
174
|
+
</p>
|
|
175
|
+
</div>
|
|
176
|
+
<div>
|
|
177
|
+
<StockStatus status={item.status} />
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
{/* Qty: top-aligned */}
|
|
182
|
+
<div className="flex-shrink-0 w-24 flex flex-col justify-start">
|
|
183
|
+
<Select
|
|
184
|
+
label=""
|
|
185
|
+
value={item.qty}
|
|
186
|
+
options={qtyOptions}
|
|
187
|
+
disableKeyboard
|
|
188
|
+
onChange={(val: string) => {
|
|
189
|
+
if (val) handleQtyChange(item.id, val);
|
|
190
|
+
}}
|
|
191
|
+
placeholder="Qty"
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
{/* Remove: top-aligned */}
|
|
196
|
+
<div className="flex-shrink-0 flex flex-col justify-start pt-1">
|
|
197
|
+
<button
|
|
198
|
+
onClick={() => handleRemove(item.id)}
|
|
199
|
+
className="text-gray-400 hover:text-gray-600"
|
|
200
|
+
>
|
|
201
|
+
<XMarkIcon className="h-5 w-5" />
|
|
202
|
+
</button>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
))}
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
{/* Order Summary */}
|
|
210
|
+
<div className="w-full lg:w-[450px]">
|
|
211
|
+
<div className="bg-gray-50 rounded-lg p-6">
|
|
212
|
+
<h2 className="text-base font-medium text-gray-900 mb-5">
|
|
213
|
+
Order summary
|
|
214
|
+
</h2>
|
|
215
|
+
<div className="space-y-3 text-sm">
|
|
216
|
+
<div className="flex justify-between">
|
|
217
|
+
<span className="text-gray-600">Subtotal</span>
|
|
218
|
+
<span>RM {subtotal.toFixed(2)}</span>
|
|
219
|
+
</div>
|
|
220
|
+
<div className="border-t pt-3 flex justify-between">
|
|
221
|
+
<span className="flex items-center gap-1 text-gray-600">
|
|
222
|
+
Shipping estimate
|
|
223
|
+
<QuestionMarkCircleIcon className="h-4 w-4" />
|
|
224
|
+
</span>
|
|
225
|
+
<span>RM {SHIPPING.toFixed(2)}</span>
|
|
226
|
+
</div>
|
|
227
|
+
<div className="border-t pt-3 flex justify-between">
|
|
228
|
+
<span className="flex items-center gap-1 text-gray-600">
|
|
229
|
+
Tax estimate
|
|
230
|
+
<QuestionMarkCircleIcon className="h-4 w-4" />
|
|
231
|
+
</span>
|
|
232
|
+
<span>RM {tax.toFixed(2)}</span>
|
|
233
|
+
</div>
|
|
234
|
+
<div className="border-t pt-3 flex justify-between text-gray-900 text-lg">
|
|
235
|
+
<span>Order total</span>
|
|
236
|
+
<span>RM {total.toFixed(2)}</span>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
<div className="mt-6">
|
|
240
|
+
<Button
|
|
241
|
+
text="Checkout"
|
|
242
|
+
type="normal"
|
|
243
|
+
className="w-full justify-center"
|
|
244
|
+
onClick={() => {}}
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
</Container>
|
|
251
|
+
);
|
|
252
|
+
});
|