refactor: enhance layout structure by adding survey sale layout and navigation tab components; streamline page components for improved readability
This commit is contained in:
parent
8786824569
commit
2a373dd712
@ -1,5 +1,5 @@
|
|||||||
import Header from '@/components/ui/common/Header'
|
import Header from '@/components/ui/common/Header'
|
||||||
|
|
||||||
export default function page() {
|
export default function page() {
|
||||||
return <Header name={'調査物件一覧'} backBtn={true} />
|
return <Header name={'調査物件一覧'} />
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
import type { Metadata } from 'next'
|
import type { Metadata } from 'next'
|
||||||
|
|
||||||
import ReactQueryProviders from '@/providers/ReactQueryProvider'
|
import ReactQueryProviders from '@/providers/ReactQueryProvider'
|
||||||
import PopupController from '@/components/ui/PopupController'
|
import PopupController from '@/components/ui/PopupController'
|
||||||
|
|
||||||
import '@/styles/style.scss'
|
import '@/styles/style.scss'
|
||||||
|
|
||||||
import type { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
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() {
|
export default function page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<DataTable />
|
||||||
<div className="sale-contents">
|
<DetailForm />
|
||||||
<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>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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() {
|
export default function page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<SearchForm />
|
||||||
<div className="sale-contents">
|
<ListTable />
|
||||||
<SearchForm />
|
|
||||||
<ListTable />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
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() {
|
export default function Main() {
|
||||||
|
const { setBackBtn } = useHeaderStore()
|
||||||
|
useEffect(() => {
|
||||||
|
setBackBtn(false)
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="main-contens">
|
<div className="main-contens">
|
||||||
|
|||||||
@ -1,33 +1,42 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
import { usePathname } from 'next/navigation'
|
||||||
|
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react'
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
||||||
|
|
||||||
import type { HeaderProps } from '@/types/Header'
|
import type { HeaderProps } from '@/types/Header'
|
||||||
|
|
||||||
import 'swiper/css'
|
import 'swiper/css'
|
||||||
import { usePathname } from 'next/navigation'
|
|
||||||
|
|
||||||
// type HeaderProps = {
|
// type HeaderProps = {
|
||||||
// name: string //header 이름
|
// name: string //header 이름
|
||||||
// backBtn: boolean // 뒤로가기 버튼 유무
|
// backBtn: boolean // 뒤로가기 버튼 유무
|
||||||
// }
|
// }
|
||||||
|
|
||||||
export default function Header({ name, backBtn }: HeaderProps) {
|
export default function Header({ name }: HeaderProps) {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const [headerAct, setHeaderAct] = useState<boolean>(false)
|
const [headerAct, setHeaderAct] = useState<boolean>(false)
|
||||||
|
const [isShowBackBtn, setIsShowBackBtn] = useState<boolean>(false)
|
||||||
|
|
||||||
if (pathname === '/login') {
|
if (pathname === '/login') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (pathname !== '/') {
|
||||||
|
setIsShowBackBtn(true)
|
||||||
|
}
|
||||||
|
}, [pathname])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="header-warp">
|
<div className="header-warp">
|
||||||
<header>
|
<header>
|
||||||
<div className="header-inner">
|
<div className="header-inner">
|
||||||
{backBtn && (
|
{isShowBackBtn && (
|
||||||
<div className="back-button-wrap">
|
<div className="back-button-wrap">
|
||||||
<button className="back-button"></button>
|
<button className="back-button"></button>
|
||||||
</div>
|
</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 = {
|
export type HeaderProps = {
|
||||||
name: string //header 이름
|
name: string //header 이름
|
||||||
backBtn: boolean // 뒤로가기 버튼 유무
|
// backBtn: boolean // 뒤로가기 버튼 유무
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user