Merge pull request 'refactor: enhance layout structure by adding survey sale layout and navigation tab components; streamline page components for improved readability' (#17) from feature/pub-yoo into dev
Reviewed-on: #17
This commit is contained in:
commit
eaddd3b2a3
@ -1,5 +1,5 @@
|
||||
import Header from '@/components/ui/common/Header'
|
||||
|
||||
export default function page() {
|
||||
return <Header name={'調査物件一覧'} backBtn={true} />
|
||||
return <Header name={'調査物件一覧'} />
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import type { Metadata } from 'next'
|
||||
|
||||
import ReactQueryProviders from '@/providers/ReactQueryProvider'
|
||||
import PopupController from '@/components/ui/PopupController'
|
||||
|
||||
import '@/styles/style.scss'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
|
||||
5
src/app/survey-sale/@navTab/default.tsx
Normal file
5
src/app/survey-sale/@navTab/default.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import NavTab from '@/components/survey-sale/common/NavTab'
|
||||
|
||||
export default function page() {
|
||||
return <NavTab />
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
import BasicForm from '@/components/survey-sale/detail/BasicForm'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<div className="sale-contents">
|
||||
<div className="sale-detail-tab-relative">
|
||||
<div className="sale-detail-tab-wrap">
|
||||
<div className="sale-detail-tab-inner">
|
||||
<button className="sale-detail-tab act">基本情報</button>
|
||||
<button className="sale-detail-tab">電気 / 屋根情報</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BasicForm />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -4,20 +4,8 @@ import DetailForm from '@/components/survey-sale/detail/DetailForm'
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<div className="sale-contents">
|
||||
<div className="sale-detail-tab-relative">
|
||||
<div className="sale-detail-tab-wrap">
|
||||
<div className="sale-detail-tab-inner">
|
||||
<button className="sale-detail-tab act">基本情報</button>
|
||||
<button className="sale-detail-tab">電気 / 屋根情報</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DataTable />
|
||||
<DetailForm />
|
||||
</div>
|
||||
</div>
|
||||
<DataTable />
|
||||
<DetailForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
import RoofInfoForm from '@/components/survey-sale/detail/RoofInfoForm'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<div className="sale-contents">
|
||||
<div className="sale-detail-tab-relative">
|
||||
<div className="sale-detail-tab-wrap">
|
||||
<div className="sale-detail-tab-inner">
|
||||
<button className="sale-detail-tab">基本情報</button>
|
||||
<button className="sale-detail-tab act">電気 / 屋根情報</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<RoofInfoForm />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
9
src/app/survey-sale/basic-info/page.tsx
Normal file
9
src/app/survey-sale/basic-info/page.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
import BasicForm from '@/components/survey-sale/detail/BasicForm'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<BasicForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
19
src/app/survey-sale/layout.tsx
Normal file
19
src/app/survey-sale/layout.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import { ReactNode } from 'react'
|
||||
|
||||
interface SurveySaleLayoutProps {
|
||||
children: ReactNode
|
||||
navTab: ReactNode
|
||||
}
|
||||
|
||||
export default function layout({ children, navTab }: SurveySaleLayoutProps) {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<div className="sale-contents">
|
||||
{navTab}
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -4,12 +4,8 @@ import SearchForm from '@/components/survey-sale/list/SearchForm'
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<div className="container">
|
||||
<div className="sale-contents">
|
||||
<SearchForm />
|
||||
<ListTable />
|
||||
</div>
|
||||
</div>
|
||||
<SearchForm />
|
||||
<ListTable />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
9
src/app/survey-sale/roof-info/page.tsx
Normal file
9
src/app/survey-sale/roof-info/page.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
import RoofInfoForm from '@/components/survey-sale/detail/RoofInfoForm'
|
||||
|
||||
export default function page() {
|
||||
return (
|
||||
<>
|
||||
<RoofInfoForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
24
src/components/survey-sale/common/NavTab.tsx
Normal file
24
src/components/survey-sale/common/NavTab.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
'use client'
|
||||
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
export default function NavTab() {
|
||||
const pathname = usePathname()
|
||||
|
||||
if (pathname === '/survey-sale') {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="sale-detail-tab-relative">
|
||||
<div className="sale-detail-tab-wrap">
|
||||
<div className="sale-detail-tab-inner">
|
||||
<button className="sale-detail-tab">基本情報</button>
|
||||
<button className="sale-detail-tab">電気 / 屋根情報</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -1,4 +1,14 @@
|
||||
'use client'
|
||||
|
||||
import { useHeaderStore } from '@/store/header'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export default function Main() {
|
||||
const { setBackBtn } = useHeaderStore()
|
||||
useEffect(() => {
|
||||
setBackBtn(false)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="main-contens">
|
||||
|
||||
@ -1,33 +1,42 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import Link from 'next/link'
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
import { Swiper, SwiperSlide } from 'swiper/react'
|
||||
|
||||
import type { HeaderProps } from '@/types/Header'
|
||||
|
||||
import 'swiper/css'
|
||||
import { usePathname } from 'next/navigation'
|
||||
|
||||
// type HeaderProps = {
|
||||
// name: string //header 이름
|
||||
// backBtn: boolean // 뒤로가기 버튼 유무
|
||||
// }
|
||||
|
||||
export default function Header({ name, backBtn }: HeaderProps) {
|
||||
export default function Header({ name }: HeaderProps) {
|
||||
const pathname = usePathname()
|
||||
const [headerAct, setHeaderAct] = useState<boolean>(false)
|
||||
const [isShowBackBtn, setIsShowBackBtn] = useState<boolean>(false)
|
||||
|
||||
if (pathname === '/login') {
|
||||
return null
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (pathname !== '/') {
|
||||
setIsShowBackBtn(true)
|
||||
}
|
||||
}, [pathname])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="header-warp">
|
||||
<header>
|
||||
<div className="header-inner">
|
||||
{backBtn && (
|
||||
{isShowBackBtn && (
|
||||
<div className="back-button-wrap">
|
||||
<button className="back-button"></button>
|
||||
</div>
|
||||
|
||||
19
src/store/header.ts
Normal file
19
src/store/header.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
type HeaderState = {
|
||||
backBtn: boolean
|
||||
setBackBtn: (backBtn: boolean) => void
|
||||
}
|
||||
|
||||
type InitialState = {
|
||||
backBtn: boolean
|
||||
}
|
||||
|
||||
const initialState: InitialState = {
|
||||
backBtn: true,
|
||||
}
|
||||
|
||||
export const useHeaderStore = create<HeaderState>((set) => ({
|
||||
...initialState,
|
||||
setBackBtn: (value: boolean) => set((state) => ({ ...state, backBtn: value })),
|
||||
}))
|
||||
@ -1,4 +1,4 @@
|
||||
export type HeaderProps = {
|
||||
name: string //header 이름
|
||||
backBtn: boolean // 뒤로가기 버튼 유무
|
||||
// backBtn: boolean // 뒤로가기 버튼 유무
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user