Move app to apps/web-react in pnpm workspace layout

This commit is contained in:
Kalle
2026-08-16 09:20:33 +03:00
parent 7e365ccfcf
commit bbc8ea57af
2913 changed files with 227 additions and 250 deletions

View File

@@ -0,0 +1,39 @@
import * as React from "react";
import { SendouSwitch } from "~/components/elements/Switch";
import type { FormFieldProps } from "../types";
import { FormFieldMessages, useTranslatedTexts } from "./FormFieldWrapper";
type SwitchFormFieldProps = Omit<FormFieldProps<"switch">, "onBlur"> & {
checked: boolean;
onChange: (checked: boolean) => void;
isDisabled?: boolean;
};
export function SwitchFormField({
name,
label,
bottomText,
error,
checked,
onChange,
isDisabled,
}: SwitchFormFieldProps) {
const id = React.useId();
const { translatedLabel } = useTranslatedTexts({ label });
return (
<div className="stack xs">
<div className="stack horizontal sm items-center">
<SendouSwitch
id={id}
isSelected={checked}
onChange={onChange}
isDisabled={isDisabled}
>
{translatedLabel}
</SendouSwitch>
</div>
<FormFieldMessages name={name} error={error} bottomText={bottomText} />
</div>
);
}