forked from React-Group/interstellar_ai
30 lines
722 B
TypeScript
30 lines
722 B
TypeScript
import React, { useState } from 'react';
|
|
|
|
interface HistoryProps{
|
|
selectedIndex: number;
|
|
setSelectedIndex: (index: number) => void;
|
|
}
|
|
|
|
const History: React.FC<HistoryProps> = ({selectedIndex, setSelectedIndex}) => {
|
|
|
|
const handleHistoryClick = (index: number) => {
|
|
setSelectedIndex(index)
|
|
}
|
|
|
|
return (
|
|
<div className="history-background">
|
|
<div className="history">
|
|
<ul>
|
|
{/* Populate with history items */}
|
|
{Array.from({ length: 20 }, (_, index) => (
|
|
<li key={index}>
|
|
<a href="#" onClick={()=>handleHistoryClick(index)}>history{index + 1}</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default History;
|