import type { Meta, StoryObj } from '@storybook/react'; import { SendHorizontal, Trash2 } from 'lucide-react'; import { useState } from 'react'; import { Stage, me, people, tasks } from '../../stories/fixtures'; import { priorityLabel, type Priority } from '../../lib/tokens'; import { PersonAvatar } from '../Avatar/Avatar'; import { StatusBadge, Swatch } from '../Badge/Badge'; import { Button, type ButtonState } from '../Button/Button'; import { Comment, CommentAuthor, CommentBody, CommentBubble, CommentComposer, CommentComposerHint, CommentComposerRow, CommentHeader, CommentInput, CommentList, CommentTime, } from '../Comment/Comment'; import { Field, FieldError, FieldLabel, FieldNote, Input, Select, SelectOption, Textarea } from '../Field/Field'; import { SegmentedControl, SegmentedControlItem } from '../SegmentedControl/SegmentedControl'; import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerActions, DrawerBody, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from './Dialog'; const meta: Meta = { title: 'Overlays/Dialog', component: Dialog, }; export default meta; type Story = StoryObj; const priorities: Priority[] = ['high', 'medium', 'low']; function PrioritySelect({ value, onValueChange }: { value: string; onValueChange: (v: string) => void }) { return ( {priorities.map((p) => ( {priorityLabel[p]} ))} ); } function GroupOptions() { return ( <> SWE · Collabry Datenbanken Übung Marketing Seminar ); } function PeopleOptions() { return ( <> {Object.entries(people).map(([k, p]) => ( {p.name} ))} ); } export const NewTask: Story = { render: function Render() { const [open, setOpen] = useState(true); const [prio, setPrio] = useState('medium'); const [title, setTitle] = useState(''); const [tried, setTried] = useState(false); const [state, setState] = useState('idle'); const submit = () => { setTried(true); if (!title.trim()) return; setState('loading'); setTimeout(() => setState('success'), 900); setTimeout(() => { setState('idle'); setOpen(false); }, 1600); }; return (
Neue Aufgabe Die zuständige Person wird benachrichtigt. Titel setTitle(e.target.value)} /> {tried && !title.trim() && Bitte gib einen Titel ein.}
Gruppe Zuständig Fällig am
Priorität
Beschreibung (optional)