feat: redesign settings page

This commit is contained in:
butterfly
2024-04-24 15:44:24 +08:00
parent f7074bba8c
commit c99086447e
55 changed files with 2603 additions and 1446 deletions

View File

@@ -1,7 +1,7 @@
import { useState } from "react";
import { useDebouncedCallback } from "use-debounce";
import { autoGrowTextArea } from "../utils";
import useMobileScreen from "./useMobileScreen";
import { useAppConfig } from "../store";
export default function useRows({
inputRef,
@@ -9,14 +9,14 @@ export default function useRows({
inputRef: React.RefObject<HTMLTextAreaElement>;
}) {
const [inputRows, setInputRows] = useState(2);
const isMobileScreen = useMobileScreen();
const config = useAppConfig();
const measure = useDebouncedCallback(
() => {
const rows = inputRef.current ? autoGrowTextArea(inputRef.current) : 1;
const inputRows = Math.min(
20,
Math.max(2 + (isMobileScreen ? -1 : 1), rows),
Math.max(2 + (config.isMobileScreen ? -1 : 1), rows),
);
setInputRows(inputRows);
},