PHP 8.2.30
Preview: table.stories.tsx Size: 2.05 KB
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/@adminjs/design-system/src/atoms/table/table.stories.tsx

import { Meta, StoryObj } from '@storybook/react'
import React from 'react'

import StoryWrapper from '../../utils/story-wrapper.jsx'
import { Button, CheckBox, Icon, Link, Text } from '../index.js'
import { Table, TableBody, TableCaption, TableCell, TableHead, TableRow } from './index.js'

export const Default: StoryObj<{ onClick: (e) => void }> = {
  render: ({ onClick }) => {
    const handleClick = (event) => {
      event.preventDefault()
      onClick(event)
    }

    const header = ['Name', 'Surname', 'Gender', 'Age']

    const data = [
      ['John', 'Doe', 'Male', '57'],
      ['Joanna', 'K', 'Female', '32'],
      ['Patrick', 'Jogs', 'Male', '35'],
      ['Elisabeth', 'Briggs', 'Female', '28'],
      ['Jda', 'Karo', 'Female', '22'],
    ]

    return (
      <StoryWrapper label="">
        <Table>
          <TableCaption>
            <Text as="span">Selected items </Text>
            <Button onClick={handleClick}>
              <Icon icon="Trash" />
              Remove
            </Button>
          </TableCaption>
          <TableHead>
            <TableRow>
              <TableCell>
                <CheckBox />
              </TableCell>
              {header.map((head, i) => (
                <TableCell key={head} onClick={handleClick}>
                  <Link href="/">
                    {head}
                    {i === 0 && <Icon icon="ChevronUp" />}
                  </Link>
                </TableCell>
              ))}
            </TableRow>
          </TableHead>
          <TableBody>
            {data.map((row) => (
              <TableRow key={row[0]}>
                <TableCell>
                  <CheckBox />
                </TableCell>
                {row.map((item) => (
                  <TableCell key={item}>{item}</TableCell>
                ))}
              </TableRow>
            ))}
          </TableBody>
        </Table>
      </StoryWrapper>
    )
  },
}

const meta: Meta<typeof Table> = {
  title: 'DesignSystem/Atoms/Table',
  component: Table,
  argTypes: {
    onClick: { action: 'clicked' },
  },
}

export default meta

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
331 B lrw-r--r-- 2026-02-28 00:31:46
Edit Download
296 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
1002 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
887 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
617 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
477 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
2.05 KB lrw-r--r-- 2026-02-28 00:32:00
Edit Download
2.80 KB lrw-r--r-- 2026-02-28 00:32:00
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).