|
| 1 | +import { useLocale } from "next-intl" |
| 2 | + |
| 3 | +import type { LocaleDisplayInfo } from "@/lib/types" |
| 4 | + |
| 5 | +import { ButtonLink } from "@/components/ui/buttons/Button" |
| 6 | + |
| 7 | +import { DEFAULT_LOCALE } from "@/lib/constants" |
| 8 | + |
| 9 | +import { useTranslation } from "@/hooks/useTranslation" |
| 10 | + |
| 11 | +type LanguagePickerFooterProps = { |
| 12 | + intlLanguagePreference?: LocaleDisplayInfo |
| 13 | + onTranslationProgramClick: () => void |
| 14 | +} |
| 15 | + |
| 16 | +const LanguagePickerFooter = ({ |
| 17 | + intlLanguagePreference, |
| 18 | + onTranslationProgramClick, |
| 19 | +}: LanguagePickerFooterProps) => { |
| 20 | + const { t } = useTranslation("common") |
| 21 | + const locale = useLocale() |
| 22 | + return ( |
| 23 | + <div className="sticky bottom-0 flex border-t-2 border-primary bg-primary-low-contrast p-0 pb-1 pt-1"> |
| 24 | + <div className="flex w-full items-center justify-between px-4"> |
| 25 | + <div className="flex min-w-0 flex-col items-start"> |
| 26 | + {locale === DEFAULT_LOCALE ? ( |
| 27 | + <p className="overflow-hidden text-ellipsis whitespace-nowrap text-xs font-bold text-body"> |
| 28 | + {intlLanguagePreference |
| 29 | + ? `${t("page-languages-translate-cta-title")} ${t(`language-${intlLanguagePreference.localeOption}`)}` |
| 30 | + : "Translate ethereum.org"} |
| 31 | + </p> |
| 32 | + ) : ( |
| 33 | + <p className="overflow-hidden text-ellipsis whitespace-nowrap text-xs font-bold text-body"> |
| 34 | + {t("page-languages-translate-cta-title")}{" "} |
| 35 | + {t(`language-${locale}`)} |
| 36 | + </p> |
| 37 | + )} |
| 38 | + <p className="text-xs text-body"> |
| 39 | + {t("page-languages-recruit-community")} |
| 40 | + </p> |
| 41 | + </div> |
| 42 | + <ButtonLink |
| 43 | + className="text-nowrap" |
| 44 | + href="/contributing/translation-program/" |
| 45 | + size="sm" |
| 46 | + onClick={onTranslationProgramClick} |
| 47 | + > |
| 48 | + {t("get-involved")} |
| 49 | + </ButtonLink> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + ) |
| 53 | +} |
| 54 | + |
| 55 | +export default LanguagePickerFooter |
0 commit comments