refactor: update layout components to use 'import type' for ReactNode and enhance Header component with dynamic title retrieval
This commit is contained in:
parent
3e16d3a767
commit
178e9c0d3e
@ -1,3 +1,5 @@
|
|||||||
export default function layout({ children }: { children: React.ReactNode }) {
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
export default function layout({ children }: { children: ReactNode }) {
|
||||||
return <div className="container">{children}</div>
|
return <div className="container">{children}</div>
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/app/pw-reset/layout.tsx
Normal file
23
src/app/pw-reset/layout.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
|
interface PwResetLayoutProps {
|
||||||
|
children: ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function layout({ children }: PwResetLayoutProps) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="container">
|
||||||
|
<div className="sale-contents">
|
||||||
|
<div className="border-frame">
|
||||||
|
<div className="pw-guide">
|
||||||
|
<div className="pw-guide-tit">パスワードをリセットする</div>
|
||||||
|
<div className="pw-guide-txt">新しいパスワードを入力してください.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
9
src/app/pw-reset/page.tsx
Normal file
9
src/app/pw-reset/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import PwResetForm from '@/components/pw-reset/PwResetForm'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<PwResetForm />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
interface SuitableLayoutProps {
|
interface SuitableLayoutProps {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ReactNode } from 'react'
|
import type { ReactNode } from 'react'
|
||||||
|
|
||||||
interface SurveySaleLayoutProps {
|
interface SurveySaleLayoutProps {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
|
|||||||
59
src/components/pw-reset/PwResetForm.tsx
Normal file
59
src/components/pw-reset/PwResetForm.tsx
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { useRouter } from 'next/navigation'
|
||||||
|
|
||||||
|
export default function PwResetForm() {
|
||||||
|
const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기
|
||||||
|
const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="border-frame">
|
||||||
|
<div className="data-form-wrap">
|
||||||
|
<div className="data-input-form-bx">
|
||||||
|
<div className="data-input-form-tit">
|
||||||
|
新規パスワード再入力 <i className="import">*</i>
|
||||||
|
</div>
|
||||||
|
<div className="data-input">
|
||||||
|
<div className="login-input pw change">
|
||||||
|
<input type={`${pwShow01 ? 'text' : 'password'}`} className="login-frame" placeholder="●●●●" />
|
||||||
|
<button className={`login-icon ${pwShow01 ? 'act' : ''}`} onClick={() => setPwShow01(!pwShow01)}>
|
||||||
|
<i className="show-icon"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="data-input-guide">10文字以内</div>
|
||||||
|
</div>
|
||||||
|
<div className="data-input-form-bx">
|
||||||
|
<div className="data-input-form-tit">
|
||||||
|
新規パスワード入力 <i className="import">*</i>
|
||||||
|
</div>
|
||||||
|
<div className="data-input">
|
||||||
|
<div className="login-input pw change">
|
||||||
|
<input type={`${pwShow02 ? 'text' : 'password'}`} className="login-frame" placeholder="●●●●" />
|
||||||
|
<button className={`login-icon ${pwShow02 ? 'act' : ''}`} onClick={() => setPwShow02(!pwShow02)}>
|
||||||
|
<i className="show-icon"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="data-input-guide">10文字以内</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="btn-flex-wrap">
|
||||||
|
<div className="btn-bx">
|
||||||
|
<button className="btn-frame n-blue icon" onClick={() => router.back()}>
|
||||||
|
戻る<i className="btn-arr"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="btn-bx">
|
||||||
|
<button className="btn-frame red icon">
|
||||||
|
リセットする<i className="btn-arr"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ import 'swiper/css'
|
|||||||
import { axiosInstance } from '@/libs/axios'
|
import { axiosInstance } from '@/libs/axios'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { useQueryClient } from '@tanstack/react-query'
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
|
import { useTitle } from '@/hooks/useTitle'
|
||||||
|
|
||||||
// type HeaderProps = {
|
// type HeaderProps = {
|
||||||
// name: string //header 이름
|
// name: string //header 이름
|
||||||
@ -25,10 +26,13 @@ export default function Header({ name }: HeaderProps) {
|
|||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
|
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
|
||||||
const { backBtn } = useHeaderStore()
|
const { backBtn } = useHeaderStore()
|
||||||
|
const { getTitle } = useTitle()
|
||||||
|
|
||||||
const { session, reset } = useSessionStore()
|
const { session, reset } = useSessionStore()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
|
let title = ''
|
||||||
|
|
||||||
if (pathname === '/login') {
|
if (pathname === '/login') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -53,7 +57,7 @@ export default function Header({ name }: HeaderProps) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<h2 className="logo">
|
<h2 className="logo">
|
||||||
<Link href={'/'}>{name}</Link>
|
<Link href={'/'}>{getTitle(pathname)}</Link>
|
||||||
</h2>
|
</h2>
|
||||||
<div className="side-button-wrap">
|
<div className="side-button-wrap">
|
||||||
<button className="side-button" onClick={() => setSideNavIsOpen(true)}></button>
|
<button className="side-button" onClick={() => setSideNavIsOpen(true)}></button>
|
||||||
|
|||||||
37
src/hooks/useTitle.ts
Normal file
37
src/hooks/useTitle.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
export const useTitle = () => {
|
||||||
|
const getTitle = (pathname: string) => {
|
||||||
|
// Handle dynamic routes first
|
||||||
|
if (pathname.startsWith('/survey-sale/') && pathname !== '/survey-sale/basic-info' && pathname !== '/survey-sale/roof-info') {
|
||||||
|
return '調査物件一覧'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathname.startsWith('/inquiry/') && pathname !== '/inquiry/list' && pathname !== '/inquiry/regist') {
|
||||||
|
return '1:1お問い合わせ詳細'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle static routes
|
||||||
|
switch (pathname) {
|
||||||
|
case '/':
|
||||||
|
return 'Hanasys 現地調査'
|
||||||
|
case '/suitable':
|
||||||
|
return '屋根材適合性の確認'
|
||||||
|
case '/survey-sale':
|
||||||
|
return '調査物件一覧'
|
||||||
|
case '/survey-sale/basic-info':
|
||||||
|
return '調査物件登録'
|
||||||
|
case '/survey-sale/roof-info':
|
||||||
|
return '調査物件新規登録'
|
||||||
|
case '/inquiry/list':
|
||||||
|
return '1:1お問い合わせ'
|
||||||
|
case '/inquiry/regist':
|
||||||
|
return '1:1お問い合わせ'
|
||||||
|
case '/pw-reset':
|
||||||
|
return 'パスワードリセット'
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 'Hanasys 現地調査'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { getTitle }
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user