import React, { useState } from "react"; import { Tabs } from "./tabs.component"; const useTabs = (args: any) => { const [current, onClick] = useState(args.value); return { ...args, current, onClick }; }; export default { title: "ReactFormio/Tabs", component: Tabs, argTypes: {}, parameters: {} }; export const Sandbox = (args: any) => { const tabs = useTabs(args); return (
f}>
{tabs?.current?.action}
); }; Sandbox.args = { items: [ { action: "back", exact: true, icon: "chevron-left", back: true }, { action: "edit", exact: true, icon: "edit", label: "Edit" }, { action: "submissions", exact: false, icon: "data", label: "Data" }, { action: "preview", exact: true, icon: "test-tube", label: "Preview" }, { action: "actions", exact: false, icon: "paper-plane", label: "Actions" }, { action: "access", exact: true, icon: "lock", label: "Access" }, { action: "export", exact: true, icon: "download", label: "Export" }, { action: "delete", exact: true, icon: "trash", label: "Delete", roles: ["administrator", "owner"] } ] }; function AddButton({ onCreate }: any) { return (
); } function HeaderChildren() { return (
test
); } export const WithCloseable = (args: any) => { args.value = args.value === undefined ? 0 : args.value; const tabs = useTabs(args); return (
f} AddButton={AddButton} HeaderChildren={HeaderChildren} >
{tabs?.current?.action}
); }; WithCloseable.args = { reverse: true, items: [ { exact: true, action: 0, label: "Test (0)" }, { exact: true, action: 1, label: "Test (1)" } ] };