1 import { createColumnHelper } from "@tanstack/react-table"
2 import { useMemo } from "react"
3 import { useTranslation } from "react-i18next"
4
5 import { StaticCountry } from "../../../../lib/data/countries"
6
7 const columnHelper = createColumnHelper<StaticCountry>()
8
9 export const useCountryTableColumns = () => {
10 const { t } = useTranslation()
11
12 return useMemo(
13 () => [
14 columnHelper.accessor("display_name", {
15 header: t("fields.name"),
16 cell: ({ getValue }) => getValue(),
17 }),
18 columnHelper.accessor("iso_2", {
19 header: t("fields.code"),
20 cell: ({ getValue }) => <span className="uppercase">{getValue()}</span>,
21 }),
22 ],
23 [t]
24 )
25 }