diff --git a/app/components/TradeForm.tsx b/app/components/TradeForm.tsx new file mode 100644 index 0000000..0b6e7c8 --- /dev/null +++ b/app/components/TradeForm.tsx @@ -0,0 +1,47 @@ +import React from 'react' +import { Input } from '@/components/ui/input' +import { Button } from '@/components/ui/button' + +interface TradeFormProps { + type: 'buy' | 'sell' + price: string + amount: string + onPriceChange: (value: string) => void + onAmountChange: (value: string) => void + baseAsset?: string + quoteAsset?: string +} + +export function TradeForm({ + type, + price, + amount, + onPriceChange, + onAmountChange, + baseAsset = 'BTC', + quoteAsset = 'USDT' +}: TradeFormProps) { + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault() + console.log(`${type} order:`, { price, amount }) + } + + return ( +
+ ) +} diff --git a/app/en/trade/BTCUSDT/page.tsx b/app/en/trade/BTCUSDT/page.tsx index a5c2f4b..c63a555 100644 --- a/app/en/trade/BTCUSDT/page.tsx +++ b/app/en/trade/BTCUSDT/page.tsx @@ -4,12 +4,12 @@ import React, { useState } from 'react' import dynamic from 'next/dynamic' import { useRouter } from 'next/navigation' import { useCandlestickData } from '@/hooks/queries/useCandlestickData' -import { Input } from '@/components/ui/input' import { OrderBook } from '@/components/OrderBook' import { MarketList } from '@/components/MarketList' import { CoinInfo } from '@/components/CoinInfo' import { Button } from '@/components/ui/button' import { cn } from '@/lib/utils' +import { TradeForm } from '@/app/components/TradeForm' const CandlestickChart = dynamic(() => import('@/components/charts/CandlestickChart'), { ssr: false }) @@ -27,10 +27,14 @@ export default function TradePage() { const { data, isLoading, isWebSocketConnected } = useCandlestickData('BTCUSDT', interval) const [buyPrice, setBuyPrice] = useState('') const [sellPrice, setSellPrice] = useState('') + const [buyAmount, setBuyAmount] = useState('') + const [sellAmount, setSellAmount] = useState('') - const handlePriceSelect = (price: number) => { + const handlePriceSelect = (price: number, amount: number) => { setBuyPrice(price.toString()) setSellPrice(price.toString()) + setBuyAmount(amount.toString()) + setSellAmount(amount.toString()) } const handleMarketSelect = (symbol: string) => { @@ -95,42 +99,24 @@ export default function TradePage() { {/* 거래 영역 - 태블릿/데스크톱 */}