-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐จ : sideCard ๋์์ธ . ๋ฐ์์น ์กฐ์
- Loading branch information
Showing
3 changed files
with
131 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
src/features/auth/components/profile-card/card-label/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
|