Files
formbricks/packages/ee/multiLanguage/components/LanguageToggle.tsx
Dhruwang Jariwala 8b5328aa74 feat: Multi language Surveys (#1630)
Co-authored-by: Johannes <johannes@formbricks.com>
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
2024-03-18 19:02:18 +00:00

38 lines
1.1 KiB
TypeScript

import { TLanguage } from "@formbricks/types/product";
import { Label } from "@formbricks/ui/Label";
import { Switch } from "@formbricks/ui/Switch";
import { getLanguageLabel } from "../lib/isoLanguages";
interface LanguageToggleProps {
language: TLanguage;
isChecked: boolean;
onToggle: () => void;
onEdit: () => void;
}
export const LanguageToggle = ({ language, isChecked, onToggle, onEdit }: LanguageToggleProps) => {
return (
<div className="flex flex-col space-y-4">
<div className="flex items-center space-x-4">
<Switch
id={`${language.code}-toggle`}
checked={isChecked}
onClick={(e) => {
e.stopPropagation();
onToggle();
}}
/>
<Label htmlFor={`${language.code}-toggle`} className="font-medium text-slate-800">
{getLanguageLabel(language.code)}
</Label>
{isChecked && (
<p className="cursor-pointer text-xs text-slate-600 underline" onClick={onEdit}>
Edit {getLanguageLabel(language.code)} translations
</p>
)}
</div>
</div>
);
};