update(front): front 폴더명 frontend로 변경

This commit is contained in:
민헌 committed 2026-06-18 11:30:26 +09:00
1 parent 698d4e72d4
commit 16848e9f63
85 files changed

No files matched your search

@@ -0,0 +1,99 @@
import { useNavigate } from 'react-router'
import { List, Loader2 } from 'lucide-react'
import { useChatStore } from '@/features/chat/stores/useChatStore'
import { Percent, Price } from '@/features/chat/components/userInputs'
import { GO_TO_LIST_TEXT } from '@/features/chat/lib/userButtonConfig'
import type { UserButtonConfig } from '@/features/chat/types'
const style = {
goToList:
'flex w-[159px] h-[48px] bg-neutral-40 hover:brightness-[0.97] rounded-[999px] items-center justify-center title-2 text-neutral-80 cursor-pointer gap-2 transition-all ease-out hover:scale-[1.01]',
black:
'flex min-w-[120px] px-[32px] h-[48px] bg-primary hover:brightness-[0.97] rounded-[999px] items-center justify-center title-2 text-primary-foreground cursor-pointer whitespace-nowrap transition-all duration-200 ease-out hover:scale-[1.01]',
gray: 'flex min-w-[120px] px-[32px] h-[48px] bg-neutral-60 rounded-[999px] items-center justify-center title-2 text-neutral-00 cursor-pointer whitespace-nowrap transition-all ease-out hover:scale-[1.01]',
white:
'flex min-w-[120px] px-[32px] h-[48px] bg-neutral-00 rounded-[999px] items-center justify-center title-2 text-neutral-80 border border-neutral-80 cursor-pointer whitespace-nowrap transition-all ease-out hover:scale-[1.01]',
}
export function UserButton({ type, text, textList, priceErrorMessage }: UserButtonConfig) {
if (type === '') return null
return (
<div className="flex w-full pb-[52px]">
<div className="grid grid-cols-[1fr_auto_1fr] items-center w-full">
<div />
<div className="flex justify-center">
{type === 'one-black' && <OneBlack text={text || '확인'} />}
{type === 'one-gray' && <OneGray text={text || '확인'} />}
{type === 'black-white' && <BlackWhite textList={[textList?.[0] || '예', textList?.[1] || '아니오']} />}
{type === 'percent' && <Percent />}
{type === 'three-black' && (
<ThreeBlack textList={[textList?.[0] || '협력사배송', textList?.[1] || '지정택배배송', textList?.[2] || '픽업배송']} />
)}
{type === 'price' && <Price priceErrorMessage={priceErrorMessage} />}
{type === 'loading' && <Loader2 className="size-8 animate-spin text-neutral-60" />}
</div>
<div className="flex justify-end">
<GoToList />
</div>
</div>
</div>
)
}
function GoToList() {
const navigate = useNavigate()
return (
<button className={style.goToList} onClick={() => navigate('/list')} aria-label="상품 목록으로 이동">
<List size={24} />
<span>상품 목록</span>
</button>
)
}
function OneBlack({ text }: { text: string }) {
const navigate = useNavigate()
const sendMessage = useChatStore((s) => s.sendMessage)
const onClick = () => (text === GO_TO_LIST_TEXT ? navigate('/list') : sendMessage(text))
return (
<button className={style.black} onClick={onClick}>
{text}
</button>
)
}
function OneGray({ text }: { text: string }) {
const sendMessage = useChatStore((s) => s.sendMessage)
return (
<button className={style.gray} onClick={() => sendMessage(text)}>
{text}
</button>
)
}
function ThreeBlack({ textList }: { textList: [string, string, string] }) {
const sendMessage = useChatStore((s) => s.sendMessage)
return (
<div className="flex gap-3">
{textList.map((t) => (
<button key={t} className={style.black} onClick={() => sendMessage(t)}>
{t}
</button>
))}
</div>
)
}
function BlackWhite({ textList }: { textList: [string, string] }) {
const sendMessage = useChatStore((s) => s.sendMessage)
return (
<div className="flex gap-3">
<button className={style.black} onClick={() => sendMessage(textList[0])}>
{textList[0]}
</button>
<button className={style.white} onClick={() => sendMessage(textList[1])}>
{textList[1]}
</button>
</div>
)
}