Skip to content

Commit

Permalink
fix ErrorPagination story
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi committed Dec 19, 2024
1 parent ec4d1d6 commit 84efbb9
Showing 1 changed file with 28 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react'
import { ErrorPagination } from './ErrorPagination'
import { withShadowPortal } from '../../../storybook/with-shadow-portal'
import { useState } from 'react'

const meta: Meta<typeof ErrorPagination> = {
title: 'ErrorPagination',
Expand Down Expand Up @@ -37,45 +38,40 @@ const mockErrors = [
]

export const SingleError: Story = {
args: {
activeIdx: 0,
previous: () => console.log('Previous clicked'),
next: () => console.log('Next clicked'),
readyErrors: [mockErrors[0]],
minimize: () => console.log('Minimize clicked'),
isServerError: false,
render: function ErrorPaginationStory() {
const [activeIdx, setActiveIdx] = useState(0)
return (
<ErrorPagination
activeIdx={activeIdx}
readyErrors={[mockErrors[0]]}
onActiveIndexChange={setActiveIdx}
/>
)
},
}

export const MultipleErrors: Story = {
args: {
activeIdx: 1,
previous: () => console.log('Previous clicked'),
next: () => console.log('Next clicked'),
readyErrors: mockErrors,
minimize: () => console.log('Minimize clicked'),
isServerError: false,
render: function ErrorPaginationStory() {
const [activeIdx, setActiveIdx] = useState(1)
return (
<ErrorPagination
activeIdx={activeIdx}
readyErrors={mockErrors}
onActiveIndexChange={setActiveIdx}
/>
)
},
}

export const LastError: Story = {
args: {
activeIdx: 2,
previous: () => console.log('Previous clicked'),
next: () => console.log('Next clicked'),
readyErrors: mockErrors,
minimize: () => console.log('Minimize clicked'),
isServerError: false,
},
}

export const ServerError: Story = {
args: {
activeIdx: 0,
previous: () => console.log('Previous clicked'),
next: () => console.log('Next clicked'),
readyErrors: [mockErrors[0]],
minimize: () => console.log('Minimize clicked'),
isServerError: true,
render: function ErrorPaginationStory() {
const [activeIdx, setActiveIdx] = useState(2)
return (
<ErrorPagination
activeIdx={activeIdx}
readyErrors={mockErrors}
onActiveIndexChange={setActiveIdx}
/>
)
},
}

0 comments on commit 84efbb9

Please sign in to comment.