Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { Switch } from "~/ui/components/Switch";
|
||||
|
||||
// Subframe migration (strangler shim):
|
||||
// Keeps the original single-toggle API (`value`/`onChange`/`disabled`) but renders the
|
||||
// Subframe design-system `Switch`. A single boolean toggle maps to `Switch` (not
|
||||
// `ToggleGroup`, which is for multi-option segmented controls).
|
||||
//
|
||||
// The legacy field was fully controlled (`value: boolean`, required `onChange`), so the shim
|
||||
// stays controlled too — `checked={value}` + `onCheckedChange={onChange}`. No internal state
|
||||
// is needed because the caller always owns the value.
|
||||
interface Props {
|
||||
value: boolean;
|
||||
onChange(checked: boolean): void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
export default function Toggle({ value, onChange, disabled }: Props) {
|
||||
return (
|
||||
<Switch checked={value} disabled={disabled} onCheckedChange={onChange} aria-label={i18nT("components.toggle.useSetting")} />
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user