/* * Copyright (c) 2020 - present Cloudogu GmbH * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ // import React from "react"; // import { storiesOf } from "@storybook/react"; // import Table from "./Table"; // import Column from "./Column"; // import TextColumn from "./TextColumn"; // import styled from "styled-components"; // // const StyledTable = styled(Table)` // width: 400px; // border: 1px dashed black; // padding: 4px; // margin: 4px; // td { // word-break: break-word; // } // `; // // storiesOf("Table", module) // .add("Default", () => ( // // {(row: any) =>

{row.firstname}

}
// { // return (a: any, b: any) => { // if (a.lastname > b.lastname) { // return -1; // } else if (a.lastname < b.lastname) { // return 1; // } else { // return 0; // } // }; // }} // > // {(row: any) => {row.lastname}} // // {(row: any) => {row.email}} //
// )) // .add("TextColumn", () => ( // // // // //
// )) // .add("Empty", () => ( // // // //
// )) // .add("Table with Word-Break", () => ( // // // // // )); import React from "react"; import styled from "styled-components"; import type { Meta, StoryObj } from "@storybook/react"; import Table from "./Table"; import Column from "./Column"; import TextColumn from "./TextColumn"; // --- Helper Components & Mock Data (preserved from your original story) --- const StyledTable = styled(Table)` width: 400px; border: 1px dashed black; padding: 4px; margin: 4px; td { word-break: break-word; } `; const tableData = [ { firstname: "Tricia", lastname: "McMillan", email: "tricia@hitchhiker.com" }, { firstname: "Arthur", lastname: "Dent", email: "arthur@hitchhiker.com" }, ]; const textColumnData = [ { id: "21", title: "Pommes", desc: "Fried potato sticks" }, { id: "42", title: "Quarter-Pounder", desc: "Big burger" }, { id: "-84", title: "Icecream", desc: "Cold dessert" }, ]; const wordBreakData = [ { id: "42", name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp_herp" }, { id: "17", name: "herp_derp_schlerp_ferp_gerp_nerp_terp_ierp_perp_lerp_merp_oerp_zerp_serp_verp" }, ]; // --- Storybook Metadata --- const meta: Meta = { title: "Components/Table", component: Table, decorators: [(Story) =>
{Story()}
], tags: ["autodocs"], }; export default meta; // --- Story Definitions --- type Story = StoryObj; // For stories with complex children or custom components, we use a `render` function. export const Default: Story = { render: () => ( {(row: any) =>

{row.firstname}

}
(a: any, b: any) => b.lastname.localeCompare(a.lastname)} > {(row: any) => {row.lastname}} {(row: any) => {row.email}}
), }; export const WithTextColumn: Story = { name: "With TextColumn", render: () => (
), }; export const Empty: Story = { render: () => (
), }; export const WithWordBreak: Story = { name: "With Word-Break", render: () => ( ), };