import { useLocation } from 'preact-iso';
import bible from '../nkjvbible'
import { Dispatch, StateUpdater } from 'preact/hooks';

// function SelectChapters(book){
// 	let chapters = []
// 	for (let i = 0; i < bible.find(a => a.name == book).chapters.length; i++) {
// 		chapters.push(i)
// 	}
// 	return (
// 		chapters.map(a => (
// 			<option key={a} value={a}>{a + 1}</option>
// 		))
// 	)
// }
export function Header({ storedBook, chapter, setChapter }: { storedBook: {
    get: () => any;
    set: (book: any) => void;
}, chapter: number, setChapter: Dispatch<StateUpdater<number>> }) {
	const { url } = useLocation();

	return (
		<header style={{ justifyContent: "space-between", minHeight: "50px" }}>

			<select value={storedBook.get()} onChange={(e) => storedBook.set(e.target.value)}>
				{bible.map(a => (
					<option key={a.name} value={a.name}>{a.name}</option>
				))}
			</select>
			{/* <select value={chapter} onChange={(e) => setChapter(e.target.value)}>
					{SelectChapters(storedBook)}
			</select> */}
		</header>
	);
}
