mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
respect reduce motion
This commit is contained in:
10 files changed
+123
-8
No files matched your search
@@ -1,10 +1,12 @@
|
||||
import { CaretDownIcon, DotFilledIcon } from "@radix-ui/react-icons";
|
||||
import type { ReactNode } from "react";
|
||||
import type { LocaleOption } from "../../core/i18n/getLocaleOptions";
|
||||
import { withLocale } from "../../hocs/withLocale";
|
||||
import { useStrings } from "../../hooks/useStrings";
|
||||
import { App } from "../../stores/app";
|
||||
import { App, ReduceMotion } from "../../stores/app";
|
||||
import { Dialog } from "../Dialog";
|
||||
import { LocaleSelect } from "../LocaleSelect";
|
||||
import { Select } from "../Select";
|
||||
import { Switch } from "../Switch";
|
||||
import { Text } from "../Text";
|
||||
import styles from "./index.module.css";
|
||||
@@ -25,6 +27,10 @@ export const SettingsDialog = withLocale(
|
||||
(state) => state.autoLoadModels,
|
||||
true,
|
||||
);
|
||||
const reduceMotion = App.useDeferred(
|
||||
(state) => state.reduceMotion,
|
||||
ReduceMotion.Device,
|
||||
);
|
||||
|
||||
return (
|
||||
<Dialog.Root>
|
||||
@@ -43,6 +49,65 @@ export const SettingsDialog = withLocale(
|
||||
<LocaleSelect options={localeOptions} />
|
||||
</div>
|
||||
|
||||
<div className={styles.row}>
|
||||
<Text>{strings.settings.reduce_motion.title}</Text>
|
||||
|
||||
<Select.Root
|
||||
value={`${reduceMotion}`}
|
||||
onValueChange={(value) => {
|
||||
App.mutate((draft) => {
|
||||
draft.reduceMotion = Number(value);
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Select.Trigger>
|
||||
<Select.Value />
|
||||
|
||||
<Select.Icon>
|
||||
<CaretDownIcon />
|
||||
</Select.Icon>
|
||||
</Select.Trigger>
|
||||
|
||||
<Select.Portal>
|
||||
<Select.Content>
|
||||
<Select.Viewport>
|
||||
<Select.Item value={`${ReduceMotion.Device}`}>
|
||||
<Select.ItemIndicator>
|
||||
<DotFilledIcon />
|
||||
</Select.ItemIndicator>
|
||||
|
||||
<Select.ItemText>
|
||||
{strings.settings.device_preference}
|
||||
</Select.ItemText>
|
||||
</Select.Item>
|
||||
|
||||
<Select.Separator />
|
||||
|
||||
<Select.Item value={`${ReduceMotion.On}`}>
|
||||
<Select.ItemIndicator>
|
||||
<DotFilledIcon />
|
||||
</Select.ItemIndicator>
|
||||
|
||||
<Select.ItemText>
|
||||
{strings.settings.reduce_motion.on}
|
||||
</Select.ItemText>
|
||||
</Select.Item>
|
||||
|
||||
<Select.Item value={`${ReduceMotion.Off}`}>
|
||||
<Select.ItemIndicator>
|
||||
<DotFilledIcon />
|
||||
</Select.ItemIndicator>
|
||||
|
||||
<Select.ItemText>
|
||||
{strings.settings.reduce_motion.off}
|
||||
</Select.ItemText>
|
||||
</Select.Item>
|
||||
</Select.Viewport>
|
||||
</Select.Content>
|
||||
</Select.Portal>
|
||||
</Select.Root>
|
||||
</div>
|
||||
|
||||
<div className={styles.row}>
|
||||
<Text>{strings.settings.auto_load_models}</Text>
|
||||
<Switch
|
||||
|
||||
Reference in new issue
Block a user