-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
506 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { graphql } from "msw"; | ||
|
||
import { MockedUrqlProvider } from "~/utils/MockedUrqlProvider"; | ||
|
||
import SearchContents, { AppSideNavQuery } from "."; | ||
import AppSideNav from "."; | ||
|
||
const meta = { | ||
component: AppSideNav, | ||
args: { | ||
style: { | ||
width: 300, | ||
height: 640, | ||
}, | ||
}, | ||
render(args) { | ||
return ( | ||
<MockedUrqlProvider> | ||
<AppSideNav {...args} /> | ||
</MockedUrqlProvider> | ||
); | ||
}, | ||
} satisfies Meta<typeof SearchContents>; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Fetching: Story = { | ||
name: "読み込み中", | ||
parameters: { | ||
msw: { | ||
handlers: { | ||
main: [ | ||
graphql.query(AppSideNavQuery, (req, res, ctx) => | ||
res(ctx.delay("infinite")) | ||
), | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const NogLoggedIn: Story = { | ||
name: "未ログイン時", | ||
parameters: { | ||
msw: { | ||
handlers: { | ||
main: [ | ||
graphql.query(AppSideNavQuery, (req, res, ctx) => | ||
res(ctx.data({ viewer: null })) | ||
), | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Normal: Story = { | ||
name: "一般ユーザー", | ||
parameters: { | ||
msw: { | ||
handlers: { | ||
main: [ | ||
graphql.query(AppSideNavQuery, (req, res, ctx) => | ||
res(ctx.data({ viewer: { isAdmin: false, isEditor: false } })) | ||
), | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Editor: Story = { | ||
name: "編集者", | ||
parameters: { | ||
msw: { | ||
handlers: { | ||
main: [ | ||
graphql.query(AppSideNavQuery, (req, res, ctx) => | ||
res(ctx.data({ viewer: { isAdmin: false, isEditor: true } })) | ||
), | ||
], | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Admin: Story = { | ||
name: "管理者", | ||
parameters: { | ||
msw: { | ||
handlers: { | ||
main: [ | ||
graphql.query(AppSideNavQuery, (req, res, ctx) => | ||
res(ctx.data({ viewer: { isAdmin: true, isEditor: true } })) | ||
), | ||
], | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.