Overview
TheTradeInterface component is a layout container that combines the TradeView and Depth components into a unified trading interface. It provides a responsive grid layout for displaying charts and market depth data.
Props
The market identifier for the trading pair (e.g., “SOL_USDC”)
Component Composition
The component renders two main child components:TradeView Component
TradeView Component
Displays the main trading chart and price visualization. Takes up 3/4 of the width on desktop layouts.Props passed:
market: Forwarded from parent component
Depth Component
Depth Component
Shows order book and recent trades data. Takes up 1/4 of the width on desktop layouts.Props passed:
market: Forwarded from parent component
Layout Structure
Responsive Grid
The component uses CSS Grid for responsive layout:- Mobile Layout (< 768px)
- Desktop Layout (≥ 768px)
- Single column: Components stack vertically
- First row: TradeView at 600px height
- Second row: Depth takes remaining space
Usage Example
Component Hierarchy
Implementation Details
Props Forwarding
The component acts as a simple container that forwards themarket prop to its children:
The component has no internal state or side effects - it’s purely presentational and focuses on layout.
Design Considerations
Fixed Height Strategy
The 600px height for the first row ensures:- Consistent chart visibility
- Adequate space for price action
- Prevents excessive vertical scrolling
Responsive Breakpoint
Themd: breakpoint (768px) was chosen to:
- Prioritize readability on smaller screens
- Maximize chart space on desktop
- Balance order book visibility
Source Code Reference
See implementation in:apps/web/src/components/TradeInterface.tsx:1-12
Full Component Code
Full Component Code