Skip to content

Commit

Permalink
๐ŸŽจ : sideCard ๋””์ž์ธ . ๋ฐ์œ„์น˜ ์กฐ์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
keeprok committed Jan 24, 2025
1 parent 508a7e5 commit 0c308e5
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 23 deletions.
11 changes: 6 additions & 5 deletions src/features/auth/components/mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export const profileMock = {
์‚ฌ์—…์ž๋ช…: "ํ„ฐ๋นˆํฌ๋ฃจ",
์‚ฌ์—…์ž๋Œ€ํ‘œ: "์ด์˜๋ก",
์‚ฌ์—…์ž๋ฒˆํ˜ธ: "01033422242",
์‚ฌ์—…์ž์ฃผ์†Œ: "์„œ์šธํŠน๋ณ„์‹œ ๊ฐ•๋‚จ๊ตฌ ๊ฐ•๋‚จ๋กœ 123-22",
์ด๋ฉ”์ผ: "[email protected]",
email: "[email protected]",
businessName: "๋ฐฉํ˜•๊ธฐ",
businessNumber: "1118194369",
businessOwner: "๋ฐฉํ˜•๊ธฐ",
businessAddress: "๊ด‘์ฃผ๊ด‘์—ญ์‹œ",
role: "member",
}
32 changes: 25 additions & 7 deletions src/features/auth/components/profile-card/card-label/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
import type { ProfileMockKeys } from ".."
import { profileMock } from "../../mock"

type CardLabelPT = {
data: ProfileMockKeys
label: string
value: string
// isEditing: boolean
// onChange?: (key: ProfileMockKeys, value: string) => void
}
export function CardLabel({ data }: CardLabelPT) {
export function CardLabel({
//data,
label,
value,
// isEditing,
//, onChange
}: CardLabelPT) {
return (
<div className="flex w-full justify-between gap-4 text-2xl">
<div className="w-32 rounded-xl border-2 py-1 text-center shadow">
{data}
</div>
<div className="min-w-36 border-b-2 px-4 text-end">
{profileMock[data]}
<div className="w-36 rounded-xl border-2 py-1 text-center shadow">
{label}
</div>
{/* {isEditing ? ( */}
<label
className="min-w-36 border-b-2 px-4 text-center"

//onChange={(e) => onChange(data, e.target.value)}
>
{value}
</label>
{/* ) : (
<div className="min-w-36 border-b-2 px-4 text-end">{value}</div>
)} */}
</div>
)
}
111 changes: 100 additions & 11 deletions src/features/auth/components/profile-card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,108 @@
import type { profileMock } from "../mock"
"use client"

import { useMutation } from "@tanstack/react-query"
import { Columns2 } from "lucide-react"
import { useState } from "react"

import { axiosInstance } from "@/config/axios"

import { CardLabel } from "./card-label"
export type ProfileMockKeys = keyof typeof profileMock

export type ProfileMockKeys =
| "businessName"
| "businessOwner"
| "email"
| "businessNumber"
| "businessAddress"

type ProfileData = {
businessName: string
businessOwner: string
email: string
businessNumber: string
businessAddress: string
}
export function ProfileCard() {
const mockTitle: ProfileMockKeys[] = ["์‚ฌ์—…์ž๋ช…", "์‚ฌ์—…์ž๋Œ€ํ‘œ", "์ด๋ฉ”์ผ"]
const [isSideCardVisible, setIsSideCardVisible] = useState(true)

const [profileData] = useState<ProfileData>({
businessName: "๋ฐฉํ˜•๊ธฐ",
businessOwner: "๋ฐฉํ˜•๊ธฐ",
email: "[email protected]",
businessNumber: "1118194369",
businessAddress: "๊ด‘์ฃผ๊ด‘์—ญ์‹œ",
})

const mockFirstTitle = [
{ key: "businessNumber", title: "์‚ฌ์—…์ž ๋ฒˆํ˜ธ" },
{ key: "email", title: "์ด๋ฉ”์ผ" },
{ key: "businessAddress", title: "์‚ฌ์—…์ž ์ฃผ์†Œ" },
]
const mockSecondTitle = [
{ key: "businessName", title: "์‚ฌ์—…์ž๋ช…" },
{ key: "businessOwner", title: "์‚ฌ์—…์ž ๋Œ€ํ‘œ" },
]

const toggleSideCard = () => setIsSideCardVisible((prev) => !prev)

return (
<div className="mt-8 flex h-fit w-2/3 flex-col gap-4 rounded-2xl border-2 p-4 shadow-md">
<div className="flex gap-3 pl-2 pt-2 text-3xl font-semibold">
<p>Profile </p>-<p>Card</p>
<div className="relative mt-8 flex w-full justify-center">
{/* Main Card */}
<div
className={`z-10 h-fit w-[54rem] min-w-[48rem] flex-col gap-4 rounded-2xl border-2 bg-white p-4 shadow-md transition-transform duration-300 ease-in-out ${
isSideCardVisible ? "-translate-x-[12rem]" : "translate-x-0"
}`}
>
<div className="flex justify-between">
<div className="flex gap-3 pl-2 pt-2 text-3xl font-semibold">
<p>Profile</p>-<p>Card</p>
</div>
<div className="flex">
<button className="mr-5">
{/* {isEditingProfile ? "์ €์žฅ" : "์ˆ˜์ •"} */}
</button>
<div>
<button
onClick={toggleSideCard}
className="flex h-10 w-10 items-center justify-center text-gray-700 shadow-sm hover:bg-gray-100"
>
<Columns2 size={24} />
</button>
</div>
</div>
</div>
<hr />
<div className="mx-7 flex h-[13rem] flex-col gap-6 py-3">
{mockFirstTitle.map((data, idx) => (
<CardLabel
key={idx}
data={data.key as ProfileMockKeys}
label={data.title}
value={profileData[data.key as ProfileMockKeys]}
/>
))}
</div>
</div>
<hr />
<div className="mx-7 flex flex-col gap-6 py-3">
{mockTitle.map((data, idx) => (
<CardLabel key={idx} data={data} />
))}

{/* Side Card */}

<div
className={`absolute bottom-0 right-0 z-0 h-[15rem] w-[24rem] transform transition-transform duration-300 ease-in-out ${
isSideCardVisible ? "translate-x-0" : "-translate-x-[25vw]"
}`}
>
<div className="h-[14.8rem] w-full min-w-[24rem] rounded-2xl border-r-2 border-t-2 py-7 shadow-md">
<div className="mx-10 flex h-full flex-col gap-6">
{mockSecondTitle.map((data, idx) => (
<CardLabel
key={idx}
data={data.key as ProfileMockKeys}
label={data.title}
value={profileData[data.key as ProfileMockKeys]}
/>
))}
</div>
</div>
</div>
</div>
)
Expand Down

0 comments on commit 0c308e5

Please sign in to comment.