import { A } from "~/ui/i18n-anchor";
import { Show, Suspense, createMemo } from "solid-js";
import { coreEntries } from "solid:collection";
import { useI18n } from "~/i18n/i18n-context";
/**
* temporary until we have proper types inside collections
*/
type ReferenceCollection = (typeof coreEntries)["reference"];
type LearnCollection = (typeof coreEntries)["learn"];
type Pagination = {
collection: ReferenceCollection | LearnCollection;
currentIndex: number;
};
export function Pagination(props: Pagination) {
const previous = createMemo(() => {
if (props.currentIndex > 0) {
return props.collection[props.currentIndex - 1];
} else {
return null;
}
});
const next = createMemo(() => {
if (props.currentIndex < props.collection.length) {
return props.collection[props.currentIndex + 1];
} else {
return null;
}
});
const i18n = useI18n();
return (