21 lines
623 B
TypeScript
21 lines
623 B
TypeScript
import type { Pagination } from "@mantine/core";
|
|
import type { ComponentProps } from "react";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
function useStocksPagePresentationVm() {
|
|
const { t } = useTranslation();
|
|
|
|
const getControlProps: ComponentProps<typeof Pagination>["getControlProps"] = control => ({
|
|
"aria-label": t(control === "previous" ? "stock.previous" : "stock.next"),
|
|
});
|
|
|
|
const getItemProps: ComponentProps<typeof Pagination>["getItemProps"] = page => ({
|
|
"aria-label": t("stock.screener.page", { page }),
|
|
});
|
|
|
|
return { getControlProps, getItemProps };
|
|
}
|
|
|
|
export { useStocksPagePresentationVm };
|