chore: initial import
This commit is contained in:
51
apps/visualizer/src/features/chart/ChartToolbar.tsx
Normal file
51
apps/visualizer/src/features/chart/ChartToolbar.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import Button from '../../ui/Button';
|
||||
|
||||
type Props = {
|
||||
timeframe: string;
|
||||
onTimeframeChange: (tf: string) => void;
|
||||
showIndicators: boolean;
|
||||
onToggleIndicators: () => void;
|
||||
seriesLabel: string;
|
||||
isFullscreen: boolean;
|
||||
onToggleFullscreen: () => void;
|
||||
};
|
||||
|
||||
const timeframes = ['1m', '5m', '15m', '1h', '4h', '1D'] as const;
|
||||
|
||||
export default function ChartToolbar({
|
||||
timeframe,
|
||||
onTimeframeChange,
|
||||
showIndicators,
|
||||
onToggleIndicators,
|
||||
seriesLabel,
|
||||
isFullscreen,
|
||||
onToggleFullscreen,
|
||||
}: Props) {
|
||||
return (
|
||||
<div className="chartToolbar">
|
||||
<div className="chartToolbar__group">
|
||||
{timeframes.map((tf) => (
|
||||
<Button
|
||||
key={tf}
|
||||
size="sm"
|
||||
variant={tf === timeframe ? 'primary' : 'ghost'}
|
||||
onClick={() => onTimeframeChange(tf)}
|
||||
type="button"
|
||||
>
|
||||
{tf}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="chartToolbar__group">
|
||||
<Button size="sm" variant={showIndicators ? 'primary' : 'ghost'} onClick={onToggleIndicators} type="button">
|
||||
Indicators
|
||||
</Button>
|
||||
<Button size="sm" variant={isFullscreen ? 'primary' : 'ghost'} onClick={onToggleFullscreen} type="button">
|
||||
{isFullscreen ? 'Exit' : 'Fullscreen'}
|
||||
</Button>
|
||||
<div className="chartToolbar__meta">{seriesLabel}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user