From 9aa90ff5f4535a48d87f2e714ecdb29754fdf442 Mon Sep 17 00:00:00 2001 From: BOHA Date: Sat, 6 Jun 2026 21:26:25 +0200 Subject: [PATCH] feat(mui): showcase Phase 3 kit components in /ui-kit (Select, Tabs, StatusChip, Pagination, sortable DataTable, DateField, Checkbox, Alert) Co-Authored-By: Claude Opus 4.8 (1M context) --- src/admin/pages/UiKit.tsx | 157 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 152 insertions(+), 5 deletions(-) diff --git a/src/admin/pages/UiKit.tsx b/src/admin/pages/UiKit.tsx index 60cac50..afd95db 100644 --- a/src/admin/pages/UiKit.tsx +++ b/src/admin/pages/UiKit.tsx @@ -1,13 +1,86 @@ +import { useState } from "react"; import ScopedCssBaseline from "@mui/material/ScopedCssBaseline"; import Box from "@mui/material/Box"; import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; -import Chip from "@mui/material/Chip"; -import { Button, Card, TextField } from "../ui"; +import { + Button, + Card, + TextField, + Select, + StatusChip, + Tabs, + TabPanel, + Pagination, + CheckboxField, + Alert, + DataTable, + DateField, + type DataColumn, +} from "../ui"; import { useTheme } from "../../context/ThemeContext"; +interface DemoRow { + id: number; + name: string; + qty: number; +} +const DEMO_ROWS: DemoRow[] = [ + { id: 1, name: "Beta", qty: 30 }, + { id: 2, name: "Alfa", qty: 10 }, + { id: 3, name: "Gama", qty: 20 }, +]; + +function SectionLabel({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ); +} + export default function UiKit() { const { theme, toggleTheme } = useTheme(); + const [selectVal, setSelectVal] = useState("a"); + const [tab, setTab] = useState("one"); + const [page, setPage] = useState(2); + const [checked, setChecked] = useState(true); + const [date, setDate] = useState("2026-06-06"); + const [sortBy, setSortBy] = useState("name"); + const [sortDir, setSortDir] = useState<"asc" | "desc">("asc"); + + const onSort = (key: string) => { + if (sortBy === key) setSortDir((d) => (d === "asc" ? "desc" : "asc")); + else { + setSortBy(key); + setSortDir("asc"); + } + }; + const sortedRows = [...DEMO_ROWS].sort((a, b) => { + const cmp = String(a[sortBy as keyof DemoRow]).localeCompare( + String(b[sortBy as keyof DemoRow]), + "cs", + { numeric: true }, + ); + return sortDir === "asc" ? cmp : -cmp; + }); + const columns: DataColumn[] = [ + { key: "name", header: "Název", sortKey: "name", render: (r) => r.name }, + { + key: "qty", + header: "Množství", + align: "right", + mono: true, + sortKey: "qty", + render: (r) => r.qty, + }, + ]; + return ( @@ -18,7 +91,7 @@ export default function UiKit() { - + Faktury @@ -27,8 +100,8 @@ export default function UiKit() { 12 vystavených tento měsíc - - + + Nová faktura + + + Kit — Phase 3 + + Select +