fix: list page storybook not rendering issue (#4560)

This commit is contained in:
Peng Xiao 2023-10-09 15:54:05 +08:00 committed by GitHub
parent 59a4b3bc31
commit d9fe3e73d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,10 +6,12 @@ import {
PageList,
PageListTrashView,
} from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import { PageIcon } from '@blocksuite/icons';
import { expect } from '@storybook/jest';
import type { Meta, StoryFn } from '@storybook/react';
import { userEvent } from '@storybook/testing-library';
import { atom } from 'jotai';
export default {
title: 'AFFiNE/PageList',
@ -61,11 +63,18 @@ export const AffineAllPageList: StoryFn<typeof PageList> = ({ ...props }) => (
<PageList {...props} />
);
const baseAtom = atom<Collection[]>([]);
AffineAllPageList.args = {
isPublicWorkspace: false,
onCreateNewPage: () => toast('Create new page'),
onCreateNewEdgeless: () => toast('Create new edgeless'),
onImportFile: () => toast('Import file'),
collectionsAtom: atom(
get => get(baseAtom),
async (_, set, update) => {
set(baseAtom, update);
}
),
list: [
{
pageId: '1',