💄 Add dropdown indicator to language selector (#552)

This commit is contained in:
Jonas Höbenreich 2023-03-13 13:22:32 +01:00 committed by GitHub
parent 39a07558ee
commit 5b78093c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,14 +2,17 @@ import clsx from "clsx";
import Cookies from "js-cookie";
import { useTranslation } from "next-i18next";
import ChevronDown from "@/components/icons/chevron-down.svg";
export const LanguageSelect: React.FunctionComponent<{
className?: string;
onChange?: (language: string) => void;
}> = ({ className, onChange }) => {
const { i18n } = useTranslation("common");
return (
<div className="relative">
<select
className={clsx("input", className)}
className={clsx("input block pr-4", className)}
defaultValue={i18n.language}
onChange={(e) => {
Cookies.set("NEXT_LOCALE", e.target.value, {
@ -39,5 +42,9 @@ export const LanguageSelect: React.FunctionComponent<{
<option value="sk">Slovenčina</option>
<option value="sv">Svenska</option>
</select>
<div className="pointer-events-none absolute inset-y-0 right-2 flex items-center">
<ChevronDown className="w-5" />
</div>
</div>
);
};