diff --git a/src/components/settingsInputs.jsx b/src/components/settingsInputs.jsx index dca9ef2..6caa12d 100644 --- a/src/components/settingsInputs.jsx +++ b/src/components/settingsInputs.jsx @@ -1,4 +1,5 @@ import { CheckBox } from "./checkbox"; +import { inputStyle } from "./styles"; function SettingsCheckBox({ label, title, className, settingName, onClick }) { return ( @@ -10,10 +11,71 @@ function SettingsCheckBox({ label, title, className, settingName, onClick }) { onClick={(e) => { window.settings[settingName] = e.target.checked; localStorage.setObj("settings", window.settings); - onClick(e); + onClick && onClick(e); }} /> ); } -export { SettingsCheckBox }; +function SettingsTextInput({ + placeholder, + title, + label, + className, + settingName, + onChange, + secret, +}) { + return ( +
+ + { + window.settings[settingName] = e.target.value; + localStorage.setObj("settings", window.settings); + onChange && onChange(e); + }} + /> +
+ ); +} + +function SettingsSelectInput({ + label, + className, + settingName, + options, + onChange, +}) { + return ( +
+ + +
+ ); +} + +export { SettingsCheckBox, SettingsTextInput, SettingsSelectInput }; diff --git a/src/components/styles.js b/src/components/styles.js new file mode 100644 index 0000000..a1cbf46 --- /dev/null +++ b/src/components/styles.js @@ -0,0 +1,4 @@ +let inputStyle = + "form-control block px-3 py-1.5 text-base font-normal text-gray-700 dark:text-white bg-white dark:bg-zinc-900 bg-clip-padding border border-solid border-gray-300 rounded-lg transition ease-in-out focus:border-blue-600 focus:outline-none"; + +export { inputStyle }; diff --git a/src/pages/create.jsx b/src/pages/create.jsx index 201af01..5fcd2c5 100644 --- a/src/pages/create.jsx +++ b/src/pages/create.jsx @@ -13,6 +13,7 @@ import remarkStringify from "remark-stringify"; import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; import { SettingsCheckBox } from "../components/settingsInputs"; +import { inputStyle } from "../components/styles"; function CreateNote() { const [preview, setPreview] = useState(false); @@ -36,7 +37,6 @@ function CreateNote() { localStorage.setItem("NoteText", md); } - let inputStyle = `form-control block px-3 py-1.5 text-base font-normal text-gray-700 dark:text-white bg-white dark:bg-zinc-900 bg-clip-padding border border-solid border-gray-300 rounded-lg transition ease-in-out focus:border-blue-600 focus:outline-none`; return (
diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index 9b6ff1e..2e07b08 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -1,4 +1,8 @@ -import { SettingsCheckBox } from "../components/settingsInputs"; +import { + SettingsCheckBox, + SettingsTextInput, + SettingsSelectInput, +} from "../components/settingsInputs"; function Settings() { return (
@@ -6,6 +10,32 @@ function Settings() { Настройки +

+ Пользователь +

+ + + + + + + +

+ Заметки +

+ + +

+ Интерфейс +

+ + + +

+ Стороннее API +

+ +
); }