Skip to content

Commit 4987eff

Browse files
committed
[#134] 🚚 reflect location change of type files on import lines
1 parent 2dadded commit 4987eff

File tree

6 files changed

+44
-22
lines changed

6 files changed

+44
-22
lines changed

src/app/(pages)/sign-in/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import { SubmitHandler, useForm } from 'react-hook-form'
44

5-
import { SignInRequest } from '@/types/auth.types'
5+
import { SignInRequest } from '@/types/api/auth.types'
66
import { useSignInMutation } from 'queries/useSignIn'
77

8-
98
export default function LoginPage(): JSX.Element {
10-
119
const {
1210
register,
1311
handleSubmit,

src/app/(pages)/sign-up/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRouter } from 'next/navigation'
44

55
import { SubmitHandler, useForm } from 'react-hook-form'
66

7-
import { SignUpRequest } from '@/types/auth.types'
7+
import { SignUpRequest } from '@/types/api/auth.types'
88
import { useSignUpMutation } from 'queries/useSignUp'
99

1010
export default function SignUpPage(): JSX.Element {

src/app/api/auth/sign-in/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextResponse } from 'next/server'
22

3-
import { SignInRequest, SignInResponseResult } from '@/types/auth.types'
3+
import { SignInRequest, SignInResponseResult } from '@/types/api/auth.types'
44

55
import { backendApi } from '@/services/api'
66

src/hooks/usePagination.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22

33
import type { PaginationState } from '@/types/hooks'
44

5-
interface UsePaginationProps {
5+
export interface UsePaginationProps {
66
totalItems: number // 전체 아이템 수
77
itemsPerPage: number // 페이지당 아이템 수
88
buttonsPerPage?: number // 한 번에 보여줄 페이지네이션 버튼 수 (기본값: 10)

src/services/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SignInRequest, SignUpRequest } from '@/types/auth.types'
1+
import { SignInRequest, SignUpRequest } from '@/types/api/auth.types'
22

33
import { backendApi, proxyApi } from '@/services/api'
44

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
1+
import React from 'react'
2+
13
import { Meta, StoryObj } from '@storybook/react'
24

35
import { Pagination } from '@/components/shared/pagination'
46

5-
import { usePagination } from '@/hooks/usePagination'
7+
import { UsePaginationProps, usePagination } from '@/hooks/usePagination'
68

79
export default {
8-
title: 'Shared/Pagination/Pagination',
10+
title: 'Shared/Pagination',
911
component: Pagination,
1012
argTypes: {
11-
currentPage: { control: { type: 'number', min: 1 }, defaultValue: 1 },
12-
totalPages: { control: { type: 'number', min: 1 }, defaultValue: 5 },
13-
hasNextPage: { control: 'boolean', defaultValue: true },
14-
hasPreviousPage: { control: 'boolean', defaultValue: false },
13+
totalItems: { control: 'number', defaultValue: 100 },
14+
itemsPerPage: { control: 'number', defaultValue: 6 },
15+
buttonsPerPage: { control: 'number', defaultValue: 10 },
1516
},
1617
} as Meta
1718

18-
export const Default: StoryObj = {
19+
const PaginationWrapper = ({
20+
totalItems,
21+
itemsPerPage,
22+
buttonsPerPage = 10,
23+
}: UsePaginationProps) => {
24+
const paginationState = usePagination({
25+
totalItems,
26+
itemsPerPage,
27+
buttonsPerPage,
28+
})
29+
30+
return (
31+
<div className='p-4'>
32+
<Pagination {...paginationState} />
33+
<div className='text-sm mt-4 text-gray-700'>
34+
<p>
35+
<strong>현재 페이지:</strong> {paginationState.currentPage}
36+
</p>
37+
<p>
38+
<strong>현재 그룹:</strong>{' '}
39+
{Math.ceil(paginationState.currentPage / buttonsPerPage)}
40+
</p>
41+
</div>
42+
</div>
43+
)
44+
}
45+
46+
export const Default: StoryObj<UsePaginationProps> = {
1947
args: {
20-
currentPage: 1,
21-
pageButtons: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
22-
totalPages: 5,
23-
hasNextPageGroup: true,
24-
hasPreviousPageGroup: true,
25-
goToPage: (page: number) => alert(`Go to page: ${page}`),
26-
goToNextPageGroup: () => alert('Next page'),
27-
goToPreviousPageGroup: () => alert('Previous page'),
48+
totalItems: 100,
49+
itemsPerPage: 6,
50+
buttonsPerPage: 10,
2851
},
52+
render: args => <PaginationWrapper {...args} />,
2953
}

0 commit comments

Comments
 (0)