diff --git a/src/App.tsx b/src/App.tsx index 2bd498a..445e0df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,9 @@ import { Suspense } from 'react'; -import Header from 'comp/Header'; -import Router from './router'; +import Header from '@/components/header'; +import Router from '@/router'; -function App(): JSX.Element { +function App() { return ( <>
diff --git a/src/components/Comments.tsx b/src/components/Comments.tsx index 7beb3ac..07dda2e 100644 --- a/src/components/Comments.tsx +++ b/src/components/Comments.tsx @@ -1,26 +1,25 @@ -import { Link } from 'react-router-dom'; -import axios from 'axios'; import { useQuery } from '@tanstack/react-query'; +import axios from 'axios'; +import { Link } from 'react-router-dom'; -import type { UseQueryResult } from '@tanstack/react-query'; -import type { Comment } from 'types'; -import { DummyResponse } from 'src/types/DummyResponse'; - -interface CommentsProperties { - postId: number; -} +import type { Comment } from '@/types'; +import { DummyResponse } from '@/types/dummy-response'; interface CommentsResponse extends DummyResponse { comments: Comment[]; } -export default function Comments({ postId }: CommentsProperties): JSX.Element { +interface Properties { + postId: number; +} + +export default function Comments({ postId }: Properties) { const { data: comments, - isLoading, + isPending, isError, error, - }: UseQueryResult = useQuery({ + } = useQuery({ enabled: postId !== undefined, queryKey: ['comments', postId], queryFn: async () => { @@ -31,7 +30,7 @@ export default function Comments({ postId }: CommentsProperties): JSX.Element { return ( <> - {isLoading ? ( + {isPending ? (

Loading...

) : isError ? (

Error: {error.message}

diff --git a/src/components/Common/Button.tsx b/src/components/Common/Button.tsx index 752da10..452ede0 100644 --- a/src/components/Common/Button.tsx +++ b/src/components/Common/Button.tsx @@ -1,5 +1,6 @@ -import { type Ref, type ButtonHTMLAttributes, forwardRef } from 'react'; -import { Button as ButtonUI } from 'lib/shadcn/components/ui/button'; +import { type ButtonHTMLAttributes, forwardRef, type Ref } from 'react'; + +import { Button as ButtonUI } from '@/components/ui/button'; interface ButtonProperties extends ButtonHTMLAttributes { children: JSX.Element | string; @@ -8,7 +9,7 @@ interface ButtonProperties extends ButtonHTMLAttributes { } const Button = forwardRef( - ({ children, type = 'button', className = '', background, ...properties }, reference) => { + ({ children, type = 'button', className, background, ...properties }, reference) => { return ( ; -}): JSX.Element { - return ( -

- {children} -

- ); -} diff --git a/src/components/Common/form/Input.tsx b/src/components/Common/form/Input.tsx index 57fcef0..481839a 100644 --- a/src/components/Common/form/Input.tsx +++ b/src/components/Common/form/Input.tsx @@ -1,5 +1,4 @@ -import { forwardRef } from 'react'; -import type { Ref, InputHTMLAttributes } from 'react'; +import { forwardRef, type InputHTMLAttributes, type Ref } from 'react'; interface InputProperties extends InputHTMLAttributes { children?: JSX.Element | boolean | string; @@ -7,13 +6,15 @@ interface InputProperties extends InputHTMLAttributes { reference?: Ref | null | undefined; } +const formInputStyle = { backgroundImage: 'none' }; + const Input = forwardRef( ({ id, type, placeholder, className, hidden = false, disabled = false, ...register }, reference) => { return ( <> { - children?: JSX.Element | boolean | string; - reference?: Ref | null | undefined; -} - -const Textarea = forwardRef( - ({ className, id, rows, placeholder, hidden, disabled, ...register }, reference) => { - return ( - <> -