AFFiNE/packages/frontend/component/.storybook
CatsJuice d412635f6b
feat(component): new hook to open confirm modal (#6342)
new exports from `@affine/component`:
```ts
import { ConfirmModalProvider, useConfirmModal } from "@affine/component"
```

Open confirm modal with hook:

```ts
const Component = () => {
  const { openConfirmModal } = useConformModal();

  const open = () => {
    openConfirmModal({
      // props of ConfirmModal
      /**
       * will show loading state when confirm clicked, and close after onConfirm finished
       */
      onConfirm: async () => {
        await new Promise((r) => setTimeout(r, 2000));
      },
    });
  }
  return <Button onClick={open}>Open</Button>
}
```
2024-03-27 13:30:30 +00:00
..
main.ts fix(core): storybook build issue (#6274) 2024-03-23 06:33:25 +00:00
polyfill.ts fix(core): storybook build issue (#6274) 2024-03-23 06:33:25 +00:00
preview.css.ts feat(component): add storybook (#5079) 2023-12-04 08:32:19 +00:00
preview.html feat(component): add storybook (#5079) 2023-12-04 08:32:19 +00:00
preview.tsx feat(component): new hook to open confirm modal (#6342) 2024-03-27 13:30:30 +00:00