version 1
Build and Deploy / test-backend (push) Successful in 1m11s
Build and Deploy / lint-frontend (push) Successful in 21s
Build and Deploy / build-backend (push) Successful in 58s
Build and Deploy / deploy (push) Canceled after 0s
Build and Deploy / build-frontend (push) Canceled after 5m38s
Build and Deploy / test-backend (push) Successful in 1m11s
Build and Deploy / lint-frontend (push) Successful in 21s
Build and Deploy / build-backend (push) Successful in 58s
Build and Deploy / deploy (push) Canceled after 0s
Build and Deploy / build-frontend (push) Canceled after 5m38s
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import { LANGUAGES } from "@/lib/languages";
|
||||
import type { UiLanguage } from "@/types/language";
|
||||
import { useTranslations } from "next-intl";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectGroup,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
|
||||
interface LanguageSelectProps {
|
||||
value: UiLanguage;
|
||||
onChange: (lang: UiLanguage) => void;
|
||||
excludeId?: UiLanguage["id"];
|
||||
}
|
||||
|
||||
export function LanguageSelect({ value, onChange, excludeId }: LanguageSelectProps) {
|
||||
const t = useTranslations("Languages");
|
||||
const options = LANGUAGES.filter((l) => l.id !== excludeId);
|
||||
|
||||
return (
|
||||
<Select
|
||||
value={value.id}
|
||||
onValueChange={(id) =>
|
||||
onChange(options.find((l) => l.id === id) ?? options[0])
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-fit border-none shadow-none px-0 dark:bg-transparent dark:hover:bg-transparent">
|
||||
<SelectValue>
|
||||
<div className="flex flex-row gap-2.5 items-center">
|
||||
<Image src={value.flag} alt={value.autonym} width={32} height={16} className="rounded-xs" />
|
||||
<h3 className="font-medium">{t(value.id)}</h3>
|
||||
</div>
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
{options.map((l) => (
|
||||
<SelectItem key={l.id} value={l.id}>
|
||||
<div className="flex flex-row items-center gap-2.5">
|
||||
<Image src={l.flag} alt={l.autonym} width={20} height={12} className="rounded-xs" />
|
||||
<div className="flex flex-col gap-0">
|
||||
<p className="font-medium">{t(l.id)}</p>
|
||||
<h5>{l.autonym}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user