mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-06 12:41:48 +02:00
💄 Add dropdown indicator to language selector (#552)
This commit is contained in:
parent
39a07558ee
commit
5b78093c6f
1 changed files with 38 additions and 31 deletions
|
@ -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>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue