import { useState } from "react"; import { CheckboxGroup, Field, Form, FormField, Input, RadioGroup, Select, Switch, TimePicker, } from "@godxjp/ui/data-entry"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, Avatar, AvatarFallback, } from "@godxjp/ui/data-display"; import { Alert, AlertDescription, AlertTitle } from "@godxjp/ui/feedback"; import { Button, Text } from "@godxjp/ui/general"; import { AppShell, Flex, PageContainer, Sidebar, type SidebarSectionProp, Topbar, } from "@godxjp/ui/layout"; import { Settings, ShieldCheck, User, Users } from "lucide-react"; const sections: SidebarSectionProp[] = [ { label: "設定", items: [ { id: "profile", label: "プロフィール", icon: User }, { id: "members", label: "メンバー", icon: Users }, { id: "security", label: "セキュリティ", icon: ShieldCheck }, { id: "preferences", label: "環境設定", icon: Settings }, ], }, ]; /** * Employee settings — a horizontal-layout (labelWidth) settings screen using Card sections. Shows * read-only system fields (employee number, joined date), a disabled field, controlled selects and * choice groups, and a save flow with a pending spinner and a "保存しました" success Alert. The * action bar lives in the page footer (Cancel + Save, primary rightmost — rule 41). Composed only * from real @godxjp/ui primitives; typography via the Text primitive. */ export default function Demo() { const [name, setName] = useState("山田 太郎"); const [department, setDepartment] = useState("sales"); const [role, setRole] = useState("member"); const [notify, setNotify] = useState(["email", "slack"]); const [coreStart, setCoreStart] = useState("10:00"); const [coreEnd, setCoreEnd] = useState("15:00"); const [twoFactor, setTwoFactor] = useState(true); const [status, setStatus] = useState<"idle" | "pending" | "saved">("idle"); function dirty() { if (status === "saved") setStatus("idle"); } function handleSave(event: React.FormEvent) { event.preventDefault(); setStatus("pending"); window.setTimeout(() => setStatus("saved"), 1000); } const pending = status === "pending"; return ( {}} product={{ name: "CoreBooks", role: "設定", color: "hsl(var(--primary))" }} /> } topbar={ C } /> } > } > {/* One
wraps all sections (nested is invalid HTML). The Form sets a default horizontal layout; the 勤務・通知 fields below override to vertical per-field. */} {status === "saved" ? ( 保存しました 従業員設定を更新しました。 ) : null} 基本情報 ラベルは固定幅の列に横並び(horizontal)。システム発番の項目は read-only。
{ setName(e.target.value); dirty(); }} disabled={pending} />